5 Replies Latest reply on Sep 28, 2019 3:03 PM by Francisco Sanchez

# Show last 12 months total from selected date

Hello,

I hope somebody can help.

I have been trying to show a 12 month total.  (Select month and year in the filters and return the totals from that date to the previous 12 months.).

Example: In the screenshot I have selected December 2015.

So in the chart, I am trying to display the total from December 2014 to December 2015.  (1 column not monthly values)

If I choose in the filters November 2015.  The total in the chart would be the November 2014 to November 2015.

Have looked at many other posts but no luck.  I might be thinking I need an LOD expression for part of the calculation.  But not sure.

I am using version: 2019.1.7

• ###### 1. Re: Show last 12 months total from selected date

Hi Francisco,

Please check attached workbook for detail.

• ###### 2. Re: Show last 12 months total from selected date

You may want to work with parameters here.

Hope this helps. Updated workbook is attached for reference.

• ###### 3. Re: Show last 12 months total from selected date

Thank you Shuhei and Hari,

Shuhei, yes, this is what I was looking for!

This is a first time I am actually working with Table calculations.

Can you help me how to set it up, to learn the process.

I had seen before several, I just spent most of this morning brushing up with Table calc videos.  But still can't apply it to this scenario the way you did.

• ###### 4. Re: Show last 12 months total from selected date

If you learn Table Calculation I recommend to see and understand Tableau's order of operations.

To get 12 months total, you should NOT use dimension filter. Because Tableau applies dimension filter before measure calculation (SUM, AVG and so on).

When you use dimension filter you CANNOT use data filtered out in the sheet.

While, when you use table calculation in filter you can calculate measures with full data, and after that you can hide data according to conditions of table calculation filter.

So I create "Selected Month" filed with using table calculation.

The reason I use LOOKUP function is that I need specify a month in this case.

Argument "offset: 0" means it show itself. ( if offset: -1 it shows previous month and if offset: +1 it shows next month.)

• ###### 5. Re: Show last 12 months total from selected date

Great!  Thank you so much for your help!  It is making more sense every time!