Tableau error Dates
DATEDIFF is being called with (string, date, date, integer). Did you mean (string, datetime, datetime, string)?
The fourth argument of DATEDIFF is the first day of the week, and it must be text such as 'sunday' or 'monday'. A number like 1 there gives the (string, date, date, integer) error.
Which formula raises it, and what fixes it?
DATEDIFF('week', [Order Date], [Ship Date], 1)The xmetric engine rejects it too.
DATEDIFF('week', [Order Date], [Ship Date], 'sunday')On each of the 3 example rows it returns:
| Region | Order Date | Ship Date | Result |
|---|---|---|---|
| East | 2025-01-05 | 2025-01-09 | 0 |
| West | 2025-02-10 | 2025-02-11 | 0 |
| West | 2025-03-01 | 2025-03-08 | 1 |
Why it works. Tableau reads start_of_week as a day name. With 'sunday', an order placed on Saturday 1 March and shipped on Saturday 8 March crosses one week boundary, so the result is 1. Pick 'monday' if your weeks start on Monday; the counts change.
The 3 example rows
Region | Order Date | Ship Date |
|---|---|---|
| East | 2025-01-05 | 2025-01-09 |
| West | 2025-02-10 | 2025-02-11 |
| West | 2025-03-01 | 2025-03-08 |
What else raises this message?
Raises it
DATEDIFF('week', [Order Date], [Ship Date], 2)Fixed
DATEDIFF('week', [Order Date], [Ship Date], 'monday')The optional start of week is a day name in quotes, not a day number.
Checked on the xmetric engine: the first fails, the fix runs.
Does my formula have this problem?
Paste your formula and run it on the example rows. It uses the fields [Region], [Order Date], [Ship Date]; rename yours to match.
Runs in your browser on the xmetric engine. Nothing is uploaded.
Which functions does this involve?
What do people ask about this error?
What is the default start of week?
It follows the data source's locale, usually Sunday in the US. Passing 'monday' as the last argument makes the calculation independent of locale.
Does the start of week change DATEDIFF('day', ...)?
No. It only matters when the date part is 'week'.
Where is this message documented?
- Where the message is reported (help.salesforce.com) checked October 17, 2026