5 Replies Latest reply on Oct 31, 2018 11:57 AM by Cédric Tran

Top N Set and Parameters Working Together

Hello all,

I am working with a dataset of my companies support tickets and I want to see the top N customers given a department.

I have a parameter for Top N Customers and a set on Customers that use the parameter.

I also have a parameter for choosing the department and a calculation that allows me to use the parameter.

Essentially what I want to do is have my end user choose a department and the top 10 customers come into the view. What do I need to do for this to happen?

• 1. Re: Top N Set and Parameters Working Together

Aaron, is possible to share the sample workbook with sample data embed? in .tbwx format.

I recommend to have filters on department and customer in the table graph and sort based on any measure to order the top N customer.

1 of 1 people found this helpful
• 2. Re: Top N Set and Parameters Working Together

I attached it.

• 3. Re: Top N Set and Parameters Working Together

Hi Aaron,

Here is how I would do:

1. create new Viz:

Department, customer name on line

nb record on label

2. on number of record, quick table calculation, Rank

3. CTRL, take the table calculation, drop it on measures, name it RANK

4. create a parameter named TOP N of type Integer

5. create new calculation, name it "Rank to Display": IF  [Rank] <= [Top N] then [Rank] end

6. put "Rank to Display" on filter, display filter

7. put department on filter, display filter

8. to display the current rank, you can also take Rank and turn it to discrete and put it on row

you have to use table calculation, otherwise, the top function will always return the top customer of all.

Cedric

2 of 2 people found this helpful
• 4. Re: Top N Set and Parameters Working Together

Cedric,

This works! Thanks! I changed the order a little bit to include my department parameter instead of having the department as a filter. Thanks for the quick response!

Just to recap the steps in case I have to come back to this at a later date.

1) Create a parameter that takes a string that shows the values of department

2) Create a Top N parameter that takes an integer

3) Create a calculated filed called Rank of Customer: RANK(SUM([Number of Records]))

4) Create calculated field called Top N Customers: IF Rank of Customer <= [Top N] THEN [Rank of Customer] END

5) Rank of Customer on FIlter

6) Department Parameter on filter

7) Change the N to whatever number you want

1 of 1 people found this helpful
• 5. Re: Top N Set and Parameters Working Together

Great ! :-)