How to swap the title in crosstab when swappting the measures using parameters

Published: 22 May 2023
Last Modified Date: 30 May 2023


When swapping measures using parameters, how to swap the title of the cross tab as well.

<Desired Behavior>
When select 'Sales' in parameter , Sales value is displayed and measure title is swapped to 'Sales'.
User-added image

When select 'Profit' in parameter , Profit value is displayed and measure title is swapped to 'Profit'
User-added image


  • Tableau Desktop


The steps below uses Text Object in a dashboard.

<STEP 1>
-Swapping Measure Values Using Parameters-

1. Connect to Sample Superstore from Tableau Desktop.
2. Create a new parameter as following.
User-added image
3. Create a new calculated field as following.
     Name : Switching the Value to Display
     Calculation : Case [Select Showing Value]
                               WHEN "Sales" THEN SUM([Sales])
                               WHEN "Profit" THEN SUM([Profit])
                               WHEN "Quantity" THEN SUM([Quantity])
4. Drag [Order Date] to Columns.
5. Drag [Switching the Value to Display] to Text on Marks.
User-added image
6. Drag [Measure Names] to Rows.
User-added image
7. Right click on parameter [Select Showing Value] -> Show Parameter.

<STEP 2>
-Swapping Measure Title-

8. Right click on 'No Measure Value' on cross tab -> Format
User-added image
9. Change the color of Default font to 'White',
User-added image
10. Create a new dashboard -> Add the sheet to dashboard.
11. Set Object type to  Floating.
User-added image
12. Add Text Object to dashboard -> Insert -> Select Parameters. Select Showing Value. -> OK
User-added image
13. Adjust the size and position of the Text Object so that it overlaps the measure value title.
User-added image
Did this article resolve the issue?