Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in BI by (17.6k points)
I need to modify some Tableau dashboards so that they show from the previous month going back 12 months.

For example, it is August 2017 now, so the company wants to see the 12 months ending in July 2017. In other words: Aug 2016, Sept 2016, Oct 2016...June 2017, July 2017.

Using Tableau's relative date filter, users can easily select "previous month" (July 2017) or "previous 12 months" (Sept 2016-Aug 2017) on the relative date filter. But they can't choose previous month going back 12 months (Aug 2016-July 2017).

I was thinking of writing a formula that sets current month as 0, previous month as 1, month before that as 2 etc and that way I can filter to only show months 1, 2, ...12. And not show month 0, the current month.

Is this the best approach? I thought Tableau would have an option for this - surely a lot of companies want to see a year worth of data ending in the previous month? (Since the current month is not yet complete so they don't want to see a partial month's data).

Thanks for your ideas!

1 Answer

0 votes
by (47.2k points)
  • You are absolutely correct about this being a common requirement. I do 'Last 12 months' filter too which excludes the current month since it is not a full month. 

  • In my case, I have defined a True/False type calculated field which I use to filter records which show in the dashboards.

  • Here is the formula that I use:

DATEDIFF('month',[My Timestamp Field],Today()) < 13 and DATEDIFF('month',[My Timestamp Field],Today()) > 0

If you also want to learn Tableau and make your career in it then I would suggest you must take up the following Tableau Training Course online. 

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...