Empower Your Visuals in Power BI: Using Parameters to Change Dimensions and Measures

We're currently in the middle of our week, concentrating on Power BI and Power Query at The Data School. Today, I'd like to introduce you to a useful feature we've picked up.

Imagine this situation: you wish to provide users of your visualization the ability to alter dimensions or measures within the visual. How can you make it happen?

Take a look at our bar chart. Right now, it displays Total Sales on the X-axis and State on the Y-axis. However, I also want to expand the view to include:

  • Total Sales by Customer
  • Total Profit by State
  • Total Profit by Customer

Step 1 - Creating a Parameter for DIMENSION Switching

Navigate to   Modeling  >  New parameter > Fields


Step 2 - Setting Up the Parameter for Dimension

  1. In the popup window for Parameters, assign a Name to your new parameter.
  2. Search for your desired dimensions in the Fields section and select them by ticking the checkboxes. These selections will appear on the left in the 'Add and reorder fields' box.
  3. You can also reorder the dimensions as needed.

Step 3 - Applying the Dimension Parameter

  1. Your new parameter will now be available both on your visual and in the Data pane (Field List) on the right side.
  2. Drag the parameter to the Y-axis of your bar chart and remove the original dimension from the Y-axis.

Step 4 - Parameter Formatting

  1. Select your parameter on the canvas.
  2. To manage the display, click on the Format your Visual icon.
  3. Access Slicer settings, choose your preferred style, and activate the Single select option.

Step 5 - Creating a Parameter for MEASURE Switching

  1. Follow the same steps as before, but this time, before creating the parameter, create new summarized measures.
  2. For instance, to switch to Profit or Sales, you'll need to create new measures using DAX expressions:
  • Total Profit = SUM(Orders[Profit])
  • Total Sales = SUM(Orders[Sales])

Step 6 - Add these new measures as fields in the second parameter.


Step 7 - Drag the second parameter to the X-axis of your visual.


Step 8 - Formatting the Measure Parameter


And there you have it! With these steps, you'll be able to offer users the freedom to dynamically alter dimensions and measures on your Power BI visualizations. Your final result could resemble something like this:

Author:
Jaroslav Tomcala
Powered by The Information Lab
1st Floor, 25 Watling Street, London, EC4M 9BR
Subscribe
to our Newsletter
Get the lastest news about The Data School and application tips
Subscribe now
© 2024 The Information Lab