Power BI, the upcoming self-service BI tool from Microsoft has been making great strides in terms of feature improvements and usability in the recent past. Despite this, there is no direct way yet that provides the user the option of choosing a specific measure for display in a visualization.

Consider a scenario where you would like to show Sales and Production of a particular commodity across a dimension – say date or location in the same visualization. Here the user needs to have the latitude to select one specific measure – Sales or Production. In cases where the data may have Actuals, Budget and Forecast, but the user may be interested only in Actuals.

In Tableau, one may consider using the measure value and measure name fields that are auto generated for achieving the required result; or one could create a parameter and create two fields whose value is based on the parameter selected. Since the Measure Name and Measure Value fields are not available in Power BI, we emulated the second method in Power BI.

The first step is to create a column of selections for the user to choose from. We achieve this by creating a table with only one column by using the enter data icon. Note that his table would have no relation to the actual data set. It is there only to capture the user’s preference as an input.

Power BI Table Input

We then add the Select measure column to the values tab of a slicer. We also make sure that single selection is enabled in the properties of the slicer to make sure that the user is able to make only one selection at a time.

Power BI

We then three calculated columns to represent the actual data that we would be using in the visualization. We architect the DAX expression such that each calculated column represents the values of the measure that is part of the selection made in the slicer. Here, When Measure 1 is selected in the slicer we would display Measure 1-Actual, Measure 1-Forecasted and Measure 1-Budget; when the other two selections are made we would only display the Actuals.

SELECTIONSel_Measure1Sel_Measure2Sel_Measure3
Measure 1Measure 1-ActualMeasure 1-BudgetMeasure 1-Forecasted
Measure 2Measure 2Null ValueNull Value
Measure 3Measure 3Null ValueNull Value

power-bi

When you make a selection in the slicer, the Table that you created has only one value so that value is returned to the switch statement by the ALLSELECTED function. The switch statement compares it with the entered values and assigns values to the calculated fields accordingly.

power-bi-switch

power-bi-switch-statement

We use null value instead of zero because we don’t want a line along the x axis when using a visualization like line chart.

Now we add the created fields to the required chart and watch the measures displayed change based on the selection made in the slicer.

When the first selection is made.

Power BI - Making A Selection

When the second selection is made

Power BI - Making A Selection

When the third selection is made.

Power BI - Making A Selection

Want to know more? Reach out to us at solutions@visualbi.com

Subscribe to our Newsletter

5920 Windhaven Pkwy
Plano TX 75093.

+1 888-227-2794

+1 972-232-2233

+1 888-227-7192

solutions@visualbi.com