Skip to main content
Skip table of contents

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.

POWERSHELL
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

POWERSHELL
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.

POWERSHELL
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:

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.