How to Create a Parameter Column Swap

Updated: Aug 5

Do you have different metrics that you want your user to be able to flip to for the same view? Perhaps you have a Bar Chart and you want you user to be able to change the views to see Sales by Category, Region or Segment. The steps below will help you change your columns dynamically with a parameter! I used the Sample - Superstore Dataset for this example.


I created the below string Parameter called Category Chooser. I picked the List option for my Allowable values and typed in Category, Region and Segment for the List of Values.


I then created a Calculated Field called Category Chooser Calc Field below.

I grabbed the Parameter I created for this calculation;


If [Category Chooser] = "Category" then [Category]

ELSEIF [Category Chooser] = "Region" then [Region]

ELSEIF [Category Chooser] = "Segment" then [Segment]

END



This calculated field will allow the user to change the view when the Parameter is selected. If the user selects Category, then the calculated field on the column will display the Category. If they select Region, then Region will display, and so on.


I put Sales on the Rows shelf and then placed this calculated field on the Columns shelf. I also removed the lines in the bar chart and removed the field labels at the top of the bar chart. I right-clicked on the Parameter and selected Show Parameter.


Here is the view by Category. You can see all of the Categories on the bottom of the chart.

Here is the view by Region. You can now see four columns instead of three for all of the regions in the data.

Last, here is the view by Segment. If you wish to see this dashboard click here.


In a previous blog post here, I reviewed how to create parameter Date Buttons and allow you to change your line chart using these buttons.



251 views0 comments