The ranking is a commonly requested feature for dashboards. Ranking helps users to quickly identify areas of interest/concern especially using the Pareto principle. When it comes to displaying the same on-screen as visual elements, there are some typical challenges we face namely :

  • Determining the number of ranks to display – this usually changes based on the Dimension / Area (Geography) etc and it sometimes leads to multiple dashboards for each scenario.
  • Determining the visual elements – dashboard real estate is limited and having too many redundant visual elements will complicate dashboard actions

To avoid this, it is possible to have dynamic behavior on the dashboard which will avoid the need for redundant visual elements.

In this blog, we are going to look at how to display Top N data (where N is user-specified in runtime) based on dynamic measures in Tableau.

1. Below is an empty canvas and will try to display Top N regions by different measures.

User defined Top N Ranking on Dynamic Measure Selection in Tableau

2. Let us drag ‘Region’ to the canvas and add ‘Total Sales’ KPI to columns. In this case, we will use a bar chart.

User defined Top N Ranking on Dynamic Measure Selection in Tableau

3. Now, let us create a user-defined Top N Parameter setting the default value to 5.

User defined Top N Ranking on Dynamic Measure Selection in Tableau

4. Enable this Parameter control in the sheet.

User defined Top N Ranking on Dynamic Measure Selection in Tableau

5. We will leave the Top N parameter for now as it is and work on a dynamic measure in the same chart. We will come back later on this.

6. Create another parameter containing a list of measures that can be selected dynamically by the user and enable the parameter control in the sheet.

User defined Top N Ranking on Dynamic Measure Selection in Tableau

7. Now, we have all the required Viz pieces, but they are all decoupled. We need to integrate all of them together.

8. Create a calculated field called “Measure” and here is the code to assign respective KPI:

User defined Top N Ranking on Dynamic Measure Selection in Tableau

9. Now, we will replace this newly created “Measure” KPI with “Total Sales” KPI in the chart. You will be able to see that the chart now interacts with KPI parameter and changes the data based on user selection. Also, sort the chart in descending order.

Total Sales:

User defined Top N Ranking on Dynamic Measure Selection in Tableau

Partner Lost:

User defined Top N Ranking on Dynamic Measure Selection in Tableau

10. So, we were able to connect the KPI parameter and the chart. But we still have one pending step. We have to connect the Top N parameter with the chart.

11. Right-click on Region and click on ‘Filter’ and navigate to ‘Top’ tab.

User defined Top N Ranking on Dynamic Measure Selection in Tableau

12. If you notice in the above image, we have setup the Top by our parameter name “Top N” (user-defined selection) and based on our calculated field “Measure”.

13. Click OK and You should be all set!

Top 5 Regions by Partner Lost:

User defined Top N Ranking on Dynamic Measure Selection in Tableau

Top 8 Regions by Total Sales:

User defined Top N Ranking on Dynamic Measure Selection in Tableau

Top 4 Regions by New Partners:

User defined Top N Ranking on Dynamic Measure Selection in Tableau

Your charts will now interact with the change in KPIs as well as the Top N ranking. This is a classic example of giving users the flexibility not only to Top N for a specific KPI but also to Top N for different KPI selection in one chart. This feature saves up a lot of space on the dashboard and helps in accommodating other important information.

To learn more about Visual BI’s Tableau Consulting & End User Training Programs, contact us here.


Corporate HQ:
5920 Windhaven Pkwy, Plano, TX 75093

+1 888-227-2794

+1 972-232-2233

+1 888-227-7192

solutions@visualbi.com


Copyright © Visual BI Solutions Inc.

Subscribe To Our Newsletter

Subscribe To Our Newsletter

Join our mailing list to receive the latest news and updates from our team.

You have Successfully Subscribed!

Share This!

Share this with your friends and colleagues!