Skip to main content

Hi,

 

I have a monthly data that goes all the way back to 2017.

I want to calculate a 3 months total (previous 2 months and current month). I understand that the first two months will not be correct because we don't have the complete data. (i.e. Jan 2017 missing information from Nov, Dec 2016).

 

However, if I just care about recent data like the last 12 months only, technically the data is there. The problem is that the date filter itself cut off all the data outside the date range and as a result the first & second month calculation is incorrect (Nov, Dec 21).

 

A long manual way to do this is to show last 14 months of data but "hide" Nov and Dec 21. Is there a better and more efficient way to do this like creating some kind of filter that precede the date filter from the Tableau order of operation standpoint so I don't have to do this manual adjustment each month as data refresh.

4 answers
  1. Nov 30, 2022, 6:35 PM

    @Alan Yau​ 

    Hi, the technique would be similar to the one you already have, but using a calculated field:

    Show:

    DATEDIFF("month",MAX([ Month]),WINDOW_MAX(MAX([ Month])))<=11

    And then Hide the false value:

    @Alan Yau​ Hi, the technique would be similar to the one you already have, but using a calculated field:Show:DATEDIFF(and uncheck show header:

    imageAttached you will find the workbook.

     

    If this post resolves the question, would you be so kind to "Select as Best"?. This will help other users find the same answer/resolution and help community keep track of answered questions. Thank you.

     

    Regards,

     

    Diego Martinez

    Tableau Visionary and Forums Ambassador

0/9000