Exploring Method 3 of Dynamic Field Formatting in Tableau
Elevating Tableau Visualization with Dynamic Formatting
A frequent requirement when building dashboards in Tableau is the facility to swap measures in a chart. This can be simply fulfilled using a calculation like the one below that returns a measure based on a parameter selection:
CASE [p. Select Measure]
WHEN "Profit" then SUM([Profit])
WHEN "Discount" then AVG([Discount])
WHEN "Sales" then SUM([Sales])
END
A Deep Dive into Dynamic Field Formatting in Tableau
Strategies for Implementing Method 3 in Tableau
How Method 3 Enhances Tableau Visualization
Mastering Dynamic Field Formatting for Optimal Data Presentation
The challenge is that each of the above measures will likely need different formatting, for example:
- Profit – displayed in thousands with a $ prefix and two decimal places
- Discount – displayed as a percentage with a % suffix and one decimal place
- Sales – displayed in thousands with a $ prefix and two decimal places
While formatting can be applied to this dynamic measure, it cannot be dynamically updated based on the parameter selection. So, Discount could end up formatted as a $ amount or your Profit formatted as a very large percentage as shown below.
Method 3 – Add a FORMAT() function
Perhaps the easiest solution is simply to have a FORMAT() function that would allow formatting to be applied to a field inside a calculation. The Syntax for such a function could be:
FORMAT(<measure>, <format string>)
Our dynamic measure calculation might then look like this:
CASE[p.select Measure]
WHEN "Profit" THEN FORMAT([Profit], "$#,0,.0K")
WHEN "Discount" THEN FORMAT([Discount],"0.0%")
WHEN "Sales" THEN FORMAT([Sales], "$#,0,.0K")
Understanding Method 3 – The Key to Dynamic Field Formatting Mastery
Step-by-Step Strategies for Dynamic Field Formatting in Tableau
Realizing the Benefits of Method 3
Tips for Successful Dynamic Field Formatting in Tableau
In my next blog post, I will talk about Dynamic Color Formatting. Stay tuned!
View Method 1 – https://www.useready.com/dynamic-field-formatting-in-tableau-method-1/
View Method 2 – https://www.useready.com/dynamic-field-formatting-in-tableau-method-two/