To calculate the Total Sales Value for all categories as displayed in the table, an LOD expression is ideal. An LOD calculation in Tableau allows you to compute values at the data level that is different from the view level. In this case, since the Total Sales Value appears consistent across different sub-categories within each category, an LOD expression can be used to fix the Total Sales Value irrespective of the sub-category detail. Here's how to set it up:
Go to the Calculations area by right-clicking in the data pane and selecting "Create Calculated Field".
Enter a name for the calculation, such as "Total Sales Value".
Enter the LOD expression: { FIXED [Category] : SUM([Sales]) }. This calculation fixes the total sales to the category level, effectively summing sales for all sub-categories within each category, irrespective of how the data is broken down in the view.
Drag this new calculated field into your visualization alongside the existing measures.
This method ensures that the Total Sales Value reflects the total for each category across all its sub-categories, matching the uniform values shown across different rows for each category in your table.
References
The explanation utilizes the concept of Level of Detail calculations in Tableau, which allows for advanced aggregations independent of the view level details. This concept is covered extensively in Tableau's official documentation and relevant training materials such as Tableau's online help resources.
Contribute your Thoughts:
Chosen Answer:
This is a voting comment (?). You can switch to a simple comment. It is better to Upvote an existing comment if you don't have anything to add.
Submit