MIP Logo

Tableau : How to format numbers when using a parameter

This post was originally published on The Data School blog between 2018 and July 2025, before our program was renamed to MIP’s Analytics Career Accelerator. References throughout this article to “The Data School” or “DS” all refer to what is now MIP’s Analytics Career Accelerator. The program, its people, and its commitment to launching outstanding analytics careers remain the same – just under a new name.

If you are having trouble viewing this article, please report it here

One of my challenges during my previous dashboard was to get the right format numbers  between currency and quantity in using a parameter in tableau. I played with the format and changed to currency, but then a dollar sign would still show for the Quantity measure.

Below are some quick steps on the solution I found which allow you to customize both.

To begin, set up a parameter with string data type and then list the two measures options

Next, you need to create a calculated field that will tell tableau how to handle the parameter

The solution is to setup  two additional calculated fields that are based on the parameter; one for the measure selected prefix, and one for the measure selected suffix. The prefix calculated field would look like this:

The formula is telling tableau that when amount is selected to display $ sign. Since quantity doesn’t need a $ sign, we would need to setup a Suffix calculated field which would look like this:

You will then need to add the Prefix and Suffix calculated field in the Mask card.

To get the measure to display correctly you need to select label and edit text to show the below format.

When amount measure is selected, a dollar sign is shown as the prefix:

 

When the Quantity measure is selected, the dollar sign is not longer showing

This example  was used in using a donut chart as a reference but could be applied for different graphs.

 

Share this post