KNOWLEDGE BASE

Unexpected Grand Totals Results When Calculating Absolute Value


Published: 14 Sep 2016
Last Modified Date: 05 Oct 2018

Issue

When adding a grand total for a calculation using ABS(), then the grand total is wrong because the absolute value is applied to the whole total rather than to every time that contributes to the total.

Environment

Tableau Desktop

Resolution

Use a level of detail (LOD) expression to set the level that the absolute value expression needs to be computed at. For example: 
  • Instead of: ABS(SUM([Profit]))/SUM([Sales])
  • Use a calculation similar to: SUM( { INCLUDE [State]: ABS(SUM([Profit])) } ) / SUM([Sales])

Cause

The Absolute function ABS() needs to be computed at a specific level.

Additional Information

The attached workbook ABS in Grant Total.twbx contains calculation examples of: 
  • Absolute Profit
  • Absolute Ratio
  • Absolute Ration (LOD)
Did this article resolve the issue?