KNOWLEDGE BASE

Error "Schema/DataTable mismatch" When Using DATEADD()


Published: 01 Dec 2018
Last Modified Date: 18 Jan 2019

Issue

When creating a calculation using DATEADD(), that has division in the interval argument, the calculation is valid.  However, when the calculation is added to the view Tableau Desktop returns the following error:
 
Unable to complete action ColumnTable:
Schema/DataTable mismatch" error when the calculation is added to the view

Environment

Tableau Desktop

Resolution

Wrap the formula in the interval argument in INT().
SUGGESTION: Add parentheses around the interval argument in INT().

For example, an original equation may look like this:
SUGGESTION: For example, an original calculation may look like this:
DATEADD('day', [Parameter]/2, [Date Field] )

And then may become this after wrapping the formula in the interval argument in INT():
SUGGESTION: And then, after encapsulating the interval argument in INT(), will look like this:
DATEADD('day', INT( [Parameter]/2 ), [Date Field] )

Cause

The DATEADD() function requires an integer for the interval argument. Division will convert a number to decimal number, also known as a float.

Additional Information

Some live data sources may not experience this issue, for example Microsoft SQL Server, as those data sources are more flexible with data types.


Discuss this article... Feedback Forum
Did this article resolve the issue?