 # How to use Dynamic Measures with multiple number formats in Tableau.– Skill Pill Video Today’s post solves one of the common situations in our daily activities, as data analysts and even end users. Today’s post is not necessarily meant to show us how to build a certain type of chart or analysis in Tableau, although we will eventually get there, but rather to provide a solution for certain cases we may face. Thus, today we will discuss how to use dynamic measures with multiple number formats in Tableau.

What we like most about Tableau is the ability to visualize and explore exactly the data that interests us. Specifically, each dimension and measure in our data set depending on the information we want to view and correlate. And for this, not infrequently, we use different parameters that help us select and identify exactly the data we need. And in these cases, we start talking about dynamic measures and how we use them in our analyzes.

#### How do we use dynamic measures with multiple number formats in Tableau?

Dynamic measures are often used in Tableau in cases where we want to visualize a certain size depending on other measures. For example, we can analyze product categories according to sales, profit or other measures that interest us. In order not to build every time another graph or dashboard in which to visualize the dimensions according to several measures, we can use dynamic measures built with the help of a parameter.

When we talk about dynamic measures with multiple number formats, we actually refer to dynamic measures, but each of them being displayed with its own format. For example, profit value can be displayed as a percentage, while the sales value as a decimal. Thus, depending on our selection and the choice of the measure we want to correlate with a certain dimension in our analysis, the number format or value will be different.

Using dynamic measures with multiple number formats provides more context for analysis and dashboard. It also offers even more interactivity to end users because they have the option to view data based on percentage, decimal or other values.

In the video below you have all the steps you need to go through to use dynamic measures with multiple number formats in your analysis.

#### Step 1: Connect to data

→ In Tableau Desktop, connect to Tableau: Sample Superstore

#### Step 2: Create the visualization

→ Create a Parameter: Measure
Data type: Integer
List of values – Display As
1 – Sales
2 – Qty
3 – Profit Ratio

→ Create a Calculated field: Dynamic Measure
CASE [Measure]
WHEN 1 THEN sum([Sales])
WHEN 2 THEN sum([Quantity])
WHEN 3 then sum([Profit])/sum([Sales])*100
END

→ Create a Calculated field: Prefix
CASE [Measure]
WHEN 1 THEN ‘\$’
WHEN 2 THEN ”
WHEN 3 THEN ”
END

→ Create a Calculated field: Sufix
CASE [Measure]
WHEN 1 THEN ”
WHEN 2 THEN ‘ q’
WHEN 3 THEN ‘%’
END

→ Drag Dynamic Measure on Columns

→ Drag Category and Sub-category on Rows

→ Drag Dynamic Measure, Prefix and Sufix on Text

→ Click on Label and edit text: <Prefix ><AGG(Dynamic Measure)><Sufix>

By Eduard Arhire