How to Change the Format for Each Item in a Dimension/Measure

Published: 02 Dec 2022
Last Modified Date: 05 Dec 2022


How to set the format for each item in a dimension/measure.
For example, in the below crosstab, how to set the format for "Discount" as [percentage] and others as [Integer]?
User-added image

This technique is needed after you pivot many measure fields to one measure which should have different formats. 



  • Tableau Desktop


Although it is possible to individually format each measure, the ability to change the format for each item in a measure is not implemented in Tableau Desktop at this time.

Please consider the below workaround:
Use the IF statement to format a numerical value in each item and then change it to a string (STR).

The steps are as follows.
1. Make a calculation to format each item and set them as Strings.
IF MIN([Field Names])="Discount" THEN STR(ROUND(AVG([Values]),1))+"%"
ELSEIF MIN([Field Names])="Profit" THEN STR(ROUND(AVG([Values]),1))
ELSEIF MIN([Field Names])="Quantity" THEN STR(ROUND(AVG([Values])))
ELSEIF MIN([Field Names])="Sales" THEN STR(ROUND(AVG([Values])))

2. Add the calculations make in Step 1 to [Text] mark
User-added image

Please also check the attached workbook for details

Did this article resolve the issue?