When you say “percent”, the next words are usually “of total”. These types of calculations help us understand the contribution of each member to the whole measure. Percents of Total in Tableau can be done easily, you just right click the measure and select the function.
1. Start by creating a hierarchy between product Category and Sub-Category, simply by dragging Sub-Category on top of Category.
2. The first step to build the report is to double click on Sales.
3. Bring Products on the Columns shelf and Tableau builds a graph for us.
4. Rotate it so we can see the graph better
5. By expanding the Product hierarchy, we can see information for the Sub-Category, as well
6. As this isn’t the easiest way to see the data, we’ll bring Sales on Label
7. Sort the report descending and we can see that each category has products that sell well and products that are not doing so good
8. We can also view the data only for the product Category, if we’d like to do so.
9. If we want to see the percentage of sales that each Sub-Category represents, we will use Tableau’s Quick Table Calculation to achieve this. This is done by opening the properties of the Sale field added to the Label, accessed the Quick Table Calculation area and selected Percent of Total. Right now, Tableau calculates the percent of sales that each Sub-Category represents based on the entire data that we brought into the view.
10. As we modified the calculation of the Sales field added to the Label mark, we now lack the sales figure for each Sub-Category.To add the sales figure to the report, drag the Sales field once more on top of the Label mark:
11. Now we have both the percentage, as well as the Sales figure.
12. However, this is not the easiest way to see the data. We can modify it, change the look, by going into the Label and modify the Text. We can see that Tableau puts the Percent of Total on top of Sales. But we can change this as we like. Cut the Sales and paste it before the Percent of Total. Add a separator and a currency code after Sales. Now we have the sales figure and the percent that each Sub-Category represents out of the total sales of products.
13. What happens if we are only interested in how much the Sub-Category sales represent out of the sales of the corresponding Category? What if we only want to see how much does the sales of Chairs represent out of the total sales of the Furniture Category? Luckily for us, Tableau has a very simple way to achieve this. Go again to the properties of the Sales field and go to the Edit Table Calculation. We can see that, by default, Tableau calculates the percent of total based on all the values added to the view. We can also see this as Tableau highlights all of the Sub-Categories. If we change the calculation method from Table (down) to Pane (down), Tableau will only take into account the Category that one Sub-Category is part of. This can only be seen as Tableau highlights only the Category. Now we have both the sales figure and the percentage that one Sub-Category represents out of the sales of the corresponding category:
14. Now it would be good to have the Profit in the report, as well. For this, drag Profit on top of the Color mark. Right away we can see that we have a Sub-Category, Tables, with negative profit. You can see this either by selecting the Sub-Category or hovering the mouse over the Sub-Category. This is how easy you can see your data with Tableau Software. As Tableau has many other Quick Table Calculations, join us on LinkedIn for more videos about Quick Table Calculations.
by Bogdan Secareanu
How to Retrieve and Process JSON Data from a REST API in Talend Are you working as a Data Engineer, and have you started using Talend? Maybe in one of your projects, you need to retrieve data from a REST […]
💡 Unlock the Power of Tableau for Smarter Data Decisions Are you ready to transform the way you see and use data? Tableau is more than just a data visualisation tool, it’s your gateway to interactive, intuitive, and impactful business […]
You are working at a Data Analytics company, and in one of your projects, you need to load data from a source into a target table using Talend. However, while running the Talend Job, the data will fail to load […]