ナレッジベース

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


発行: 22 May 2023
最終修正日: 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])
                           END
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
この記事で問題は解決しましたか?