1 of 1 people found this helpful
Simplest solution is to (1) Pivot your years in your data (2) use Tableau's built-in Top N feature.
Select 2017 & 2018 columns and then right-click and select Pivot from sub-menu:
Thereafter, rename Pivot Field Names to Year and Pivot Field Values to Amount and your data will now look like below (breaks your % Chg calc & Rank calc, but will be easier to do after):
Then drag and drop as shown:
Drag Brand to Filters Card and select Top 10 by Amount SUM:
Now you'll have your Top 10 for both years and then turn on Grand Totals:
% Difference is just another instance of SUM([Amount]) and uses a Quick Table Calc to perform the difference.
If this answers your question please mark it as correct so that others may find it in their search for a solution in the future. Best, Don How to Mark an answer as Correct
We would love to hear your feedback on your Tableau Community Forums experience.
Please take this 5 minute survey.
Don, Thank you very much for your help. Really appreciate it!
I duplicated the steps you indicated in the write-up. I got the same results as you, but I noticed that the Top 10 are not being filtered correctly. When I removed the Top 10 filter there are 4 brands that have higher volume: Seagram's Gin, Pinnacle Vodka, Paul Masson, and Jim Beam - that are not included in your Top 10 chart. The true Top 10 total should be 1,068,254 (2018). If you have a few minutes to take a look I'd appreciate it.
If you have a moment would you take a look at my follow-up reply to your solution. Although the solution is pulling in 10 brands, only 6 of the brands are actually in the top 10; the remaining 4 do not belong in the top 10 by 2018 volume. I tried all sort of things but can't get the true top 10 with a totaling of those 10.
Appreciate any help you can offer. Thanks.
Apologies for the delayed response. Many of us were at Tableau Conference 2019, Las Vegas this past week. So, in your case this has to do with Tableau's Order of Operations. Please see this reference: Tableau's Order of Operations - Tableau Notice where Dimension Filters fall for Top N? It's below Context Filters. We want to force Tableau to contextually address 'State' first and ahead of any Dimension Filters such as Top N. So...
Right click State and select Add to Context. The pill will change from Blue to Gray:
Thereafter you'll get your correct dimensions and values:
Awesome, Don, thank you. I also appreciate the referral the the Tableau Notice. Very helpful. Thanks again for your help. Andrew