KNOWLEDGE BASE

Error "DATEDIFF is being called with (...). Did you mean (string, datetime, datetime, string)?" When Using DATEDIFF Calculation


Published: 08 Jun 2018
Last Modified Date: 08 Sep 2018

Issue

When using DATEDIFF in a calculated field, a message similar to the following may appear:
DATEDIFF is being called with (string, date, date, integer). Did you mean (string, datetime, datetime, string)?

Environment

Tableau Desktop

Resolution

Ensure the correct field types are in use.

For example, the following calculation will not work:
DATEDIFF('month',[Order Date],[Ship Date],1)

Instead, the calculation should be written as follows:
DATEDIFF('month',[Order Date],[Ship Date],'sunday')

 

Cause

Although DATEDIFF may be used with dates instead of datetimes, the start_of_week field must be a string and not an integer.
Did this article resolve the issue?