1 of 1 people found this helpful
Can you please show your data with dates in data source? Depending on how your dates presented you may have to use different functions.
sorry i was texti from my phone so I can't see your file
Thank you for including your packaged workbook. It really helps us help you, by seeing your data, your calculated fields, etc. And thank you for stating your version number, that saves us the trouble of trying each version to find which one you used.
There are a couple of problems with your Date calculation DATEPARSE('MMM yyyy',MID([Pivot field names],8)).
The first problem in your calculation is the use of MID([Pivot field names],8). This returns only the 8th and subsequent characters in the string, so which is meaningless in this case. See the field [Use of MID] in Sheet 2.
The second problem is your use of the DATEPARSE() function. Your date strings are in the format "1/1/2015". DATEPARSE() uses the definition of date formats at Formatting Dates and Times - ICU User Guide, so 'MMM yyyy' would match a string like 'Jan 2015'. If it can't match the date, DATEPARSE() will return NULL. To match '1/1/2015' the calculation should be one of these:
If your dates are in the format month/day/year, then: DATEPARSE('M/d/yyyy',[Pivot field names])
If your dates are in the format day/month/year, then: DATEPARSE('d/M/yyyy',[Pivot field names])
Based on your formula using "MMM yyyy" I am guessing you are using the day/month/year format. See the field [Date corrected], which assumes this format. (My system is configured for month/day/year, so I had to modify the default format to display the date as day/month/year with no time.)
However, if the date format is the default for your system, then there is likely a much simpler way: just change the data type. Tableau should be able to automatically recognize the date. To illustrate this, I duplicated the field [Pivot field names], creating [Pivot field names (copy)]. Then, I just right-clicked, and chose Change Data Type -> Date. Because my system is configured for month/day/year, that is how it interpreted your dates, but if you do this in your system, it should interpret it based on your locale settings.
Finally, it makes things much simpler if you rename the field [Pivot field names]. Just right-click and Rename.
I hope that helps. Please see my attached example, also in v9.2.
Date issue Sil Monteleone.twbx 37.0 KB
Bill Lyons Thank you for your quick solution to help me I was able to make it super easy with your explanation. I see I have a lot to learn.
Im sending a screenshot of a couple of charts i've played with since I applied your solution.
Promise to look more deeply into date formats, luckly I'll be able to help someone in the future.
Great! Glad it worked, and glad you learned something!