One of the most awesome things I learned during my first months using Tableau is the broad functionalities of Parameter Actions. Another thing being the importance of a bar chart in an organization. Therefore, I couldn’t be happier that Tableau launched this GAME CHANGER feature in version 2019.2 a couple of months ago, which also means that there are so many things we can do with it that will level up our charting game.

Nonetheless, thinking out loud on the usability of a new feature is not always easy and thus, learning from the used-cases is the easiest way to learn how to apply this in our data. These are 5 examples of how to use Parameter Actions in a bar chart:

  1. Drill down (displaying different bars)
  2. Drill down (within the same graph)
  3. Labeling
  4. Sorting
  5. Compare Bar Sizes

So let’s dive into the Superstore  data and see the usability of Parameter Actions illustrated using Bar Chart:

1. Drill down (displaying different bars)

This approach enables us to drill down from Category into Sub-Category while showing the full bars for each Sub-Category

Parameter Actions_GIF1B

Steps:

  1. Create a Parameter named Parameter: Category or Sub-Category with Data type: String and Allowable values: All

  2. Create a Calculated Field called Category Drilldown as below:

    IF [Parameter: Category or Sub-Category] = [Category]
    THEN [Sub-Category]
    ELSE [Category]
    END

  3. Drag Sales into Column and Category and Category Drilldown into Rows.

  4. Place the Sheet you just made into Dashboard.

  5. Click on Dashboard Tab → Actions → Add Action → Change Parameter.

  6. In Source Sheets: thick your Sheet, in Target Parameter: choose Parameter: Category or Sub-Category, and in Value Field: choose Category Drilldown (Sample - Superstore).

  7. Click Ok, and now you should be able to click one Category and see the bars that represent Sales of each Sub-Category

Parameter Actions_GIF1

1 Full instructions: Drill down (displaying different bars)

 

2. Drill down (within the same bars)

This approach enables us to drill down from Category into Sub-Category while keeping the number of bars based on Category

Parameter Actions_GIF2B

Steps:

(skip to the 4th step if you’ve already done the previous section)

  1. Create a Parameter named Parameter: Category or Sub-Category with Data type: String and Allowable values: All
  2. Create a Calculated Field called Category Drilldown as below:

    IF [Parameter: Category or Sub-Category] = [Category]
    THEN [Sub-Category]
    ELSE [Category]
    END


  3. Drag Sales into Column and Category into Rows.

  4. Drag Category Drilldown to Color and Sales to Label in the Marks.

  5. Place the Sheet you just made into Dashboard.

  6. Click on Dashboard Tab → Actions → Add Action → Change Parameter.

  7. In Source Sheets: tick your Sheet, in Target Parameter: choose Parameter: Category or Sub-Category, and in Value Field: choose Category Drilldown (Sample - Superstore).

  8. Click Ok, and now you should be able to click one Category and see the bars that represent Sales of each Sub-Category.

Parameter Actions_GIF2

2 Full instructions: Drill down (within the same bars)

 

3. Labeling

This approach enables us to hover over a Sub-Category in the bar chart and see its Sales value toward the end of the bar

Parameter Actions_GIF3B

Steps:

(skip to the 4th step if you’ve already done the previous section)

  1. Create a Parameter named Parameter: Category or Sub-Category with Data type: String and Allowable values: All
  2. Create a Calculated Field called Category Drilldown as below:


    IF [Parameter: Category or Sub-Category] = [Category]
    THEN [Sub-Category]
    ELSE [Category]
    END

  3. Create a Create a Calculated Field and name it Label Bar Chart as below, and drag it to Label in Marks:

    IF [Parameter: Category or Sub-Category] = [Sub-Category]
    THEN [Sales]
    ELSE NULL
    END

  4. Place the Sheet you just made into Dashboard

  5. Click on Dashboard Tab → Actions → Add Action → Change Parameter

  6. In Source Sheets: thick your Bar Chart Sheet, in Target Parameter: choose Parameter: Category or Sub-Category, and in Value Field: choose Sub-Category (Sample - Superstore)

  7. Click Ok, and now you should be able to hover over a Sub-Category and see the Sales value at the end 


Parameter Actions_GIF3
3
Full instructions: Labeling



4. Sorting

This approach enables us to sort the bar chart based on our chosen measure (Sales or Quantity or Profit)

Parameter Actions_GIF4B

Steps:

  1. Drag Sales, Quantity, Profit into column and Sub-Category into Rows
  2. Create a Parameter named Parameter: Category or Sub-Category with Data type: String and Allowable values: List. Write Sales, Quantity, and Profit into the list and click Ok
  3. Create a Calculated Field called Sort as below:


    CASE [Parameter: Sort]
    WHEN 'Sales' THEN [Sales]
    WHEN 'Quantity' THEN [Quantity]
    WHEN 'Profit' THEN [Profit]
    END

  4. Click on the down arrow of Sub-Category in Rows and choose Sort

  5. Choose Sort By: Field, Sort Order: Descending, Field Name: Sort, Aggregation: Sum

  6. Make a second Sheet and place Measure Names into Filters, check Sales, Quantity, and Profit

  7. Add Measure Values into Detail and Measure Names into Text in the Marks

  8. Drag Measure Names into the Columns

  9. Add both Sheets into a Dashboard

  10. Click on Dashboard Tab → Actions → Add Action → Change Parameter

  11. In Source Sheets: tick your Sheet with the text and untick the Bar Chart sheet, in Target Parameter: choose Parameter: Sort, and in Value Field: choose Measure Names (Sample - Superstore)

  12. Click Ok, and now you should be able to click on the Sales, Quantity, Profit text and see the bar charts sorted accordingly


Parameter Actions_GIF4
4
Full instructions: Sorting

5. Compare Bar Sizes

Sometimes in a bar chart, we would like to maintain the Sort in alphabetical order or based on a specific field. Therefore we should find a way to be able to see the higher or lower performer than our chosen customer without changing the sorting order. With this approach, we will be able to compare the bar when hovering over the Top 10 Customer with the highest sales and see other Customers whose performance is better in terms of Sales.

Parameter Actions_GIF5B

Steps:

  1. Union Order table from Superstore data with itself

  2. Create a Parameter named Sales Parameter with Data type: Float and Allowable values: All

  3. Create a Calculated Field called Value Above Selected as below:

    SUM([Sales]) - [Sales Parameter]

  4. This field will subtract Sales to the Sales of the chosen Sub-Category in the parameter of your choice later on

  5. Create another Calculated Field named Break Values as below:

    IF AVG([Table Value]) < 1

    THEN 

        (IF avg([Sales Parameter]) <= SUM([Sales])

         THEN avg([Sales Parameter]) 

         ELSE SUM([Sales])

         END)

    ELSE 

        (IF [Value Above Selected] > 0 THEN [Value Above Selected]

        ELSE 0

         END)

    END

    With a Calculated Field Table Value as:

    IF [Table Name] = 'Orders' THEN 0

    ELSE 1

    END



  6. In this calculation, we are trying to compare the sum of sales of each bar to the bar you selected. With the union table we did on the first stage, this calculation will generate bars that are equal and larger to the Sales value of the Bar you select in the Sales Parameter later on. If the value is less than the parameter of your choice, this calculation will return the value of the bar itself.

  7. Create another Calculated Field named Break Values Label as below:

    IF SUM([Table Value]) > 0 AND [Break Values] > 0

    THEN [Break Values]

    ELSE NULL

    END

  8. This field will create a distinction between Bars that have a value less than and bigger than the one you select on the parameter.

  9. Drag the Customer Name to Rows and to Filters card. Choose Condition in the Filter and set to By field: Top 10 based on Sales

  10. Now drag Break Values to Columns

  11. And to the Marks card, drag Table Name to Color, Break Value Labels to Label, and Sales to Tooltip. The reason why we add Sales to tooltip is just that we need to place it somewhere in the view to be able to have control over it in the Parameter Action

  12. Add this sheet into a Dashboard, and add the Parameter Actions by clicking on Dashboard Tab → Actions → Add Action → Change Parameter

  13. Name the Parameter as Compare Bar Chart. Don’t forget to choose Run Action On: Hover. Thick on our previously made sheet in the Source Sheet, and set Target Parameter as Sales Parameter with Value field: SUM(Sales) (Sample - Superstore (2)) and set the Aggregation to SUM

  14. Now in your Dashboard, you should be able to hover to a specific Customer Name and see other customers who have a higher sales

  15. If necessary, you can also add a Reference Line in your sheet by clicking right on your Axis and choose Add Reference Line with Scope: Entire Table, Value: Sales Parameter, and Label: None. Set the Line formatting according to your preference.

Parameter Actions_GIF5

5
Full instructions: Compare bar sizes

Now that you’ve successfully trained yourself using Superstore data, let’s think out of the box and reckon that you might as well implement these examples in different types of graphs using your own data set. 

Remember that these 5 examples are not the only ways of making the most out of Parameter Actions. Tableau is an amazing tool that can help you broadly analyze your data. So, if you’re curious to learn more about Parameter Actions and other great stuff Tableau has to offer, or should you be eager to know more about how BI and Analytics can be pivotal in helping your business to grow, contact Biztory and we’ll certainly help you figure it out!

Author
Issye Margaretha

Issye Margaretha

I help you get insights from your data. Easier. Faster.

Read more articles of this author
Let's discuss your data challenges

Join our community of data enthusiasts

Get industry insights, expert tips and Biztory news sent straight to your inbox with our monthly newsletter.