9 Replies Latest reply on Mar 24, 2016 10:12 AM by John Sobczak

# Month-over-Month % Difference

Hi all, I'm seeking assistance please to a problem I have encountered regarding table calculations:

I have a matrix where the years are rows and the months are columns and the cell values are populated with an amount like so:

I can calculate the month-over-month % difference by adding a quick table calculation > percentage difference and compute using Table (Across then Down) relative to previous to produce this:

However, my problem is when I would like to sort the years from largest to smallest, like so:

The % difference is wrong for January... it should be blank for Jan 2015 rather than -32% and (4,890/4,963) - 1 = -1% for Jan 2016 rather than blank. I have tried every which way to recalculate this though to no avail. It's like I need a "Across then Up" calculation.

Has anyone else encountered this problem and manage to solve it? if so, your help will be much appreciated!

• ###### 1. Re: Month-over-Month % Difference

If you use the "Advanced" option in the Table Calc dialog box, there is a sort option in there.  I have done this in the attached workbook on last tab called Sort Years.

• ###### 2. Re: Month-over-Month % Difference

Hello John,

I'm unable to view the attachment as it was created using a newer version of Tableau and I am unable to update (restrictions). Would you be able to take a screenshot of the solution please?

• ###### 3. Re: Month-over-Month % Difference

Does this help?

• ###### 4. Re: Month-over-Month % Difference

Also, I don't have Month on here, but that would go in the Partitioning side and not the addressing side of the Advanced Table Calc Dialog Editor.

• ###### 5. Re: Month-over-Month % Difference

Thanks John, alas no luck however.

I have tried to replicate your workbook in the attached, though that produces YoY rather than MoM.

• ###### 6. Re: Month-over-Month % Difference

That is, the value I am trying to get next to January-2014 sales figure (241,269) is the percentage difference from December-2013 sales figure (405,454), which is (241,269/405,454) - 1 = -40.5%

I can get this when the rows are sorted in by Year ascending order though cannot work out how to get it when the sorted in descending order.

• ###### 7. Re: Month-over-Month % Difference

There was a problem with my Table Calc sort.  I had it sorted on Sum of Years.  It should be Max, Min or Avg.  This is because sum is adding the year across the multiple records.  Attached is the corrected in ver 9.0.  Is this what you need?

1 of 1 people found this helpful
• ###### 8. Re: Month-over-Month % Difference

That's it! Many thanks!

• ###### 9. Re: Month-over-Month % Difference

Sure no problem.  Welcome to the tricky world of Table Calcs