1 of 1 people found this helpful
if DATEDIFF('year',[Order Date],TODAY())=0
and DATEDIFF('month',[Order Date],TODAY())<=5 then [Sales]
Why not just use the Tableau out of the box relative date filter setting to last 5 months? Can't get any simpler than that.
Yeah john is right however if you require a separate column then we have to go with the calculation I had given
The data refreshes every month in tableau.When I use relative filter then tableau is not refreshing data automatically. I have already checked this.
Thank you very much for the reply. Your code worked me perfectly.