KNOWLEDGE BASE

Change the Width of a Bar Graph by Specifying a Numerical Value in a Parameter


Published: 24 Oct 2022
Last Modified Date: 24 Oct 2022

Question

How to change the width of a bar graph by specifying a numerical value in a parameter.
Example for Size 3:
User-added image
Example for size 7:
User-added image

 

Environment

  • Tableau Desktop

Answer

1. Connect to Sample Superstore data.
2. Create a new calculated field with the following:
    Name : Rank
    Calculation : RANK(ATTR([Category]))
3. Create a new parameter as demonstrated here:
User-added image
4. Right-click on Bar Size > Show Parameter.
5. Create a new calculated field with the following:
    Name : Size Calculation
    Calculation : avg([Bar Size])/10
6. Drag Sales to Rows.
7. Drag Rank to Columns.
8. Drag Category to Color on the Marks card.
User-added image
9. Right-click on Rank on Columns and Edit Table Calculation then Set as follows:
User-added image
10. Drag Category to Label on the Marks card.
User-added image
11. Change the graph type from Automatic to Bar.
User-added image
12. Drag Size Calculation to Size on Marks.
User-added image
13. Click on Size on Marks and select check in as Fixed.
User-added image
14. Right-click on Rank > Show Header.

 
Did this article resolve the issue?