6 Replies Latest reply on Nov 26, 2018 9:43 AM by Jose Gonzalez

Filter Top N, based on Grand Totals of a Table with several columns.

Hello -

I have been searching the forum with no success in regards of this doubt.

I am being prompted to filter a multi-column table based only on Grand Totals, i.e.:

Category
Sales (Q1)Sales (Q2)Sales (Q3)Sales (Q4)Sales (Total)
Furniture10000015002500
Laptops800600140002800
Video cameras000600600
Video-games2002004501501000
Pets00154560
Laundry80000008000
Miscellaneous45454545180

The expected outcome would be to filter the top 3 categories in sales (Total), but keeping the details of their Quarterly sales:

Rank
Category
Sales (Q1)Sales (Q2)Sales (Q3)Sales (Q4)Sales (Total)
1Laundry80000008000
2Laptops800600140002800
3Furniture10000015002500

However, Tableau is calculating the Ranks based on columns, therefore, showing something like:

Category
Sales (Q1)Sales (Q2)Sales (Q3)Sales (Q4)Sales (Total)
Furniture100015002500
Laptops80060014002800
Video cameras600
Video-games200450150
Pets
Laundry80008000
Miscellaneous4545

Can this be fixed to obtain the expected results?

• 1. Re: Filter Top N, based on Grand Totals of a Table with several columns.

Jose,

How does your source data look like? Does it has 4 fields of each quarter ? Also total column is calculated by you or is it in source already?

Thanks,

AB

• 2. Re: Filter Top N, based on Grand Totals of a Table with several columns.

Hi, Jose

Can you provide your sample workbook?

ZZ

• 3. Re: Filter Top N, based on Grand Totals of a Table with several columns.

Actually, the Quarter is calculated based on [Sales Date] field, since is a field people should be able to modify based on timeframes.

Total columns is the [Sales] field with no quarterly details.

• 4. Re: Filter Top N, based on Grand Totals of a Table with several columns.

Hi, Zhouyi Zhang

Please find attached a similar workbook with the sales filter applied.

• 5. Re: Filter Top N, based on Grand Totals of a Table with several columns.

Jose,

You can achieve this using sets:

create a set for category field as

And put this on filter shelf, you will get as:

Attaching WB for reference.

Thanks,

AB

• 6. Re: Filter Top N, based on Grand Totals of a Table with several columns.

Thanks, Ankit!

You've solved my question.

I really appreciate it.