4 Replies Latest reply on Nov 7, 2019 2:45 PM by Rishi Rajani

# How to show Top N in Tableau and show  total for the N selected instead of grand total?

so i am attaching a workbook where i want to see my top customers by amount paid. so i created a index function that give me the rank. i added the rank as filter so i can see my top N customers by selecting the filter. the issue i have is that the grand total is not changing when i change my top N. so the total amount for all my 6 customers is 3020. when i select to see my top 5 or top 3 customers, the amount is not changing. it's still saying 3020. any help is appreciated.

• ###### 1. Re: How to show Top N in Tableau and show  total for the N selected instead of grand total?

Hi Tony,

Here is the Solution

Top 5

Top 4

Top 6

• Create a copy of the Customer as Customer(Copy) and drag it to details
• Create a parameter to Choose Top N
• Create a Rank Calculation as

• Create a Filter Calc and Set it TRUE in Filter

• For Your  Amount Calculation Create a Window SUM Calc  which would Take care of Top N Filteration

Drag Rank to Row as Discrete First Pill, Filter to Filter Shelf and Edit Table Calculation as:

Drag Top N sales to the Label and Set Compute as to Customer(Copy) and That's it.

Thanks

Deepak

If it Helps, Pl mark it Helpful and CORRECT to Close Thread.

Customizing Grand Totals – Part 2 | Drawing with Numbers

1 of 1 people found this helpful
• ###### 2. Re: How to show Top N in Tableau and show  total for the N selected instead of grand total?

Deepak, this is works great!

• ###### 3. Re: How to show Top N in Tableau and show  total for the N selected instead of grand total?

Why do you have to create a copy of Customer? I have multiple dimensions in my view, do I need to create a copy of each one and drag to details?

• ###### 4. Re: How to show Top N in Tableau and show  total for the N selected instead of grand total?

Hey, I have more then one field vs the only customer field in your example. Can you please suggest on what can be done?