Tableau Customizing Number Units

Example of a visual with customized number units (M and K).

Approach 1: All In One

Step 1: Creating a character measure with customized number units.

STR(ROUND(ZN(SUM([MeasureName]))/ IF ABS(SUM([MeasureName]) >= 1000000000 THEN 1000000000 ELSEIF ABS(SUM([MeasureName])) >= 1000000 THEN 1000000 ELSEIF ABS(SUM([MeasureName])) >= 1000 THEN 1000 ELSE 1 END,2) + IF ABS(SUM([MeasureName])) >= 1000000000 THEN 'B' ELSEIF ABS(SUM([MeasureName])) >= 1000000 THEN 'M' ELSEIF ABS(SUM([MeasureName])) >= 1000 THEN 'K' ELSE '' END

This calculation only works with positive numbers.

Approach 2: Combo Measures

Step 1: Creating a new measure that sets the value with desired number of decimals. Ex.: 1,232 → 1.2

ROUND(ZN(SUM([MeasureName]))/ IF ABS(SUM([MeasureName]) >= 1000000000 THEN 1000000000 ELSEIF ABS(SUM([MeasureName])) >= 1000000 THEN 1000000 ELSEIF ABS(SUM([MeasureName])) >= 1000 THEN 1000 ELSE 1 END,2)

Step 2: Creating a new measure for the suffix.

IF ABS(SUM([MeasureName])) >= 1000000000 THEN 'B' ELSEIF ABS(SUM([MeasureName])) >= 1000000 THEN 'M' ELSEIF ABS(SUM([MeasureName])) >= 1000 THEN 'K' ELSE '' END

Step 3: Combine measure and suffix on visuals.

 


See Also:

Â