Show measures in Power BI based on slicer selection
One of the very common requirement of Power BI users is that of showing only those measures in a visual which are selected in a slicer. In this blog let's understand how you can implement such a logic in your model.
To begin you need a model in Power BI.
Here is a basic report to begin with.
And then you need to create a new table in the model that will hold the names of the measures
Now create a measure that will help in determing the value that is selected in the slicer.
Next bring this measure in the visual and create a slicer from the column of the table that we added in the model.
Now you can make selection over the slicer and based on that the value of the Selected Measure will change. You can see that upon selecting Total Cost the measure is returing the exact same value as of the Total Cost Measure.
And if I don't make any selection then the measure returns the value of Total Sales measure, this is happening because in the SELECTEDVALUE measure I have provided "Total Sales" as the alternate option.
Unfortunately if you want to show values for multiple selections then that is not possible with this setup, for this kind of report you will need to rely on Calculation Groups and Calculation Items, which I will cover in a future post.