A client calculates the percent of total sales for a particular region compared to all regions.
Which calculation will fix the automatic recalculation on the % of total field?
To correctly calculate the percent of total sales for a particular region compared to all regions, and to ensure that the calculation does not get inadvertently recalculated with each region filter application, the recommended calculation is:
{FIXED [Region]: sum([Sales])}: This part of the formula computes the sum of sales for each region, regardless of any filters applied to the view. It uses a Level of Detail expression to fix the sum of sales to each region, ensuring that filtering by regions won't affect the calculated value.
SUM([Sales]): This part computes the total sum of sales across all regions and is recalculated dynamically based on the filters applied to other parts of the dashboard or worksheet.
Combining the two parts: By dividing the fixed regional sales by the total sales, we get the proportion of sales for each region as compared to the total. This calculation ensures that while the denominator adjusts according to filters, the numerator remains fixed for each region, accurately reflecting the sales percentage without being affected by the region filter directly.
Reference This calculation follows Tableau's best practices for using Level of Detail expressions to manage computation granularity in the presence of dashboard filters, as outlined in the Tableau User Guide and official Tableau training materials.
Currently there are no comments in this discussion, be the first to comment!