I have tried doing the same calculation using the sample superstore data and it worked fine. I was actually trying to find what kinda of error it will generate. I don't think there is any problem with the calculated field since it is providing the desired output and its valid. I have also checked there is no time associated with the order date and the ship date.
Please refer to the screenshot below.
If you have any further queries on this let me know. If possible please share the workbook or the screenshot of the error. That will be more helpful.
2 of 2 people found this helpful
As the others have said use DATEDIFF. I've only seen this issue one time and that was when your data was originally datetime from the raw source and you convert it to date in Tableau. It works fine until you refresh again and something seems to break in the background. Not sure if that's what happened but DATEDIFF is the way to go.
Hi Carl, this is exactly what I just learned - our raw source was datetime, and I converted to date.
I was mainly curious if that "something that seems to break in the background" was experienced by others - glad to hear I'm not alone.
What database were you using? This is probably database specific.
I'm using a Teradata connection, to a user database (and pulling a table that is actually a "view"), the date field dimensions are all datetime in the database.
I changed the data connection from one teradata view to another, which is what seems to have cause the issue., as Carl had encountered the mini-bug similarly.
(On Tableau Desktop 9.1)
Thanks Jesse. It looks like we only support date minus date on a handful of databases. We should add more. DATEDIFF will also work, as several others pointed out.