In a comment by TarikB at the end of Andy Kriebel's recent article, Tarik would like to see the revenue share of the top teams versus that of the rest of the league. It is where I got the inspiration to design a dynamic pie chart. Here is the result with the following features:
  • showing the top N teams in regular slices.
  • showing the rest of the teams in a single slice: "Others".
  • N is a parameter that one can pick between 1-19.
  • pie slices are sorted clockwise and "Others" is the last slice.
A pie chart may not be very differentiating especially when there are many slices. This dynamic pie chart gives some control to users so that they can select the number of slices as they please. Hope that the technique presented here can spice up the pie a little bit.
The detail of the design is as follows. It takes 5 steps + some cleanup.

1.Create a [Top N] parameter. N is between 1-19, because the number of teams in a league is 20 and 20 vs 0 doesn't make sense. Right-click on the parameter and show parameter control.
2.Create two calculated fields: [PremierLeague Revenue] and [PremierLeague Team]. The original data table has 3 columns: League, Team and Revenue. These two fields extract the Premier League part of the data. It is similar to create [PremierLeague Team]. 
3.Create a set for the Top N teams. In General tab, select 'Use all'.
In Top tab, pick 'By field' and make sure to select the [Top N] parameter.
4.Create Top N Team labels and "Others" labels. This is done through a calculated field. The logic lets the label be the team name if in top N teams, else it shows "Others". 20-N is the number of teams in 'Others'.
5.Create the Pie Chart

5.1 Select chart type to be Pie Chart

5.2 Drag [PremierLeague Team Labels] dimension to the color shelf and sort it by revenue in descending order. This way the pie will be clockwise by order of revenue.

5.3 Drag [PremierLeague Revenue] measure to the angle shelf. This will create slices with different sizes in proportion to the team revenue.
5.4 Drag both [PremierLeague Team Labels] and [PremierLeague Revenue] to the Label shelf. Use table calculation on [PremierLeague Revenue] to get % of total for each slice.
Then format the labels as follows.
6.Cleanup

6.1 Create a blank dimension and drag it to both row and column shelves. Then click on the pills to hide both row and column headers. There will be more canvas for the pie chart.

6.2 Exclude the null values
When N>=19, in the color legend, there appears a 'Null'. It is part of Others most of time except when N>=19 where Others doesn't exist. For cleanup, click on the 'Null' in color legend and exclude it.


Voila, we will have a dynamic pie chart for Premier League. Then do the same for La Liga and use the same [Top N] parameter to control it. We can thus compare the top team share of the TV+commercial revenue and the rest of the league!

Top N & Grouping Others Series



0

Add a comment

(Refresh the page if you want to view the gif image multiple times. Or go to Tableau Public and click the button at the top-right corner.)

Jake and I collaborated on a dashboard. He told me that he learnt a way to create an in-place help page in Tableau. He first saw it at a conference somewhere and couldn't recall who the speaker was. So I am blogging here about it but the credit goes to somebody else. If anyone knows who the original creator is, leave a comment below.

The key idea is to float a semi transparent worksheet on top of the dashboard, where a help text box is strategically placed on top of each chart. This way, we can explain how to view each chart and what data points are important, etc. This worksheet is collapsible by a show/hide button. 

Below I would like to show how this worksheet can be constructed.

1. Sheet with a single data mark.

  • Double click the empty space in Marks panel and add two single quotes. Make the null pill a text label. This creates a single null mark.
  • Set the view as "Entire View"

2. Create an show/hide button

  • Go to the target dashboard
  • Drag a floating vertical container to the dashboard, making it cover all the area of interest.
  • Drag the Single Null Mark sheet and drop it into the above container. Hide the sheet title.
  • Create an open/close button for the container and place the button at the top-right corner.

3. Add annotations

  • Format the sheet background opacity as 70% in the layout manager             
  • Select area annotations and place them anywhere of interest. 
  • Write help text and format it to highlight important messages.  
  • The text can serve as functional guide and/or insight guide.

Here is an example. Feel free to download the workbook and explore. Click the "i" button at the top-right corner to view the in-place help. 

0

Add a comment

Blog Archive
Loading
Dynamic Views theme. Powered by Blogger. Report Abuse.