Error "Tableau Data Engine Error: 4: mismatched case result types (case duration datetime)" Using MakeDateTime

Published: 27 Jan 2017
Last Modified Date: 27 Sep 2017


When you use a calculation like MakeDateTime(MakeDate(dateparts, [field]), the following error occurs:
Tableau Data Engine Error: 4: mismatched case result types (case duration datetime).

The calculation works as expected in Tableau Desktop 9.0. 


Tableau Desktop 9.1 - 10.3 


Option 1

Upgrade to Tableau Desktop 10.4. For more information, see Upgrading Tableau Desktop in Tableau Help.

Option 2

If you have hour:minute:second data in the data source, change how the date in MakeDateTime is calculated. For example, instead of:

MAKEDATETIME(MAKEDATE(1899,12,30),[Order Date])

Change [Order Date] to a custom date with the detail as Hours, then again for Minutes, and finally for seconds. Once you have these three parts, 

MAKEDATETIME(MAKEDATE(1899,12,30),MAKETIME([Order Date (hours)], [Order Date (minutes)], [Order Date (seconds)])

Will work and you will get a valid date time.


In Tableau Desktop versions 9.1 - 10.3, both a date part and time part were required to use MakeDateTime. 
Did this article resolve the issue?