KNOWLEDGE BASE

Unexpected Grand Totals Results When Calculating Absolute Value


Published: 14 Sep 2016
Last Modified Date: 05 Sep 2017

Issue

When adding a grand total for a calculation using ABS(), then the grand total is wrong. because

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?