The third and final webinar in the series will be held Thursday, August 29 at Noon EDT. You can sign up here. The webinar will focus on using Table Calculations to answer any questions we can come up with. Feel free to submit scenarios to us via email. The only requirement is that the scenario be able to be replicated using the Superstore Sales sample data set in Tableau, which is also what we will be using for this post. This example appeared in the last 10 minutes of so of the session 2 webinar, which can be found here (once it gets published).
Step 1:
- Create a chart of SUM( [Profit] ) per [Customer]
- Sort the [Customer]s in descending order of SUM( [Profit] )
- Calculate each [Customer]'s rank in the ordering, i.e. the index.
- Create the following calculated field.
- Force "Compute Using" to use [Customer]
Customer Rank |
Step 3:
- Calculate the total number of [Customer]s
- Create the following calculated field.
- Force "Compute Using" to use [Customer]
Number of Customers |
Now, let's make sure that these calculations are working as we intended. The Labels Shelf is great for this.
Customer Ranking Test |
Step 4:
- Create a parameter to store our N%. For ease of use, 5% should be 5, not .05. We will handle the mathematics inside the calculation.
Top/Bottom N% |
Step 5:
- Create a field that labels the Top N% as "Top N%" and the Bottom N% as "Bottom N%", with the value of N placed into the field.
- Create the following calculated field.
Top/Bottom N% of Customers |
Step 6:
- Add this field to the Rows Shelf before [Customer]
- Filter the chart using this field
Be careful when you do this. Since the labels change via a parameter, you may run into issues if you choose to filter on the fields directly. Instead, choose to exclude NULL. This is also the same reasoning why we couldn't use Manual Sorting to place Top before Bottom.
Top/Bottom N% Filter |
Top/Bottom N% Chart |
P.S.
Remember to sign up for the webinar! There will be plenty of cool stuff to see.
Brad Llewellyn
Associate Data Analytics Consultant
Mariner, LLC
llewellyn.wb@gmail.com
https://www.linkedin.com/in/bradllewellyn
https://www.linkedin.com/in/bradllewellyn