Forum Discussion
Having a dynamic measure depending on different selections
- 5 years ago
Anonymous ,Based on what I got. with help from independent table you can try measure slicer
measure slicer
my video: https://www.youtube.com/watch?v=b9352Vxuj-M
https://community.powerbi.com/t5/Desktop/Slicer-MTD-QTD-YTD-to-filter-dates-using-the-slicer/td-p/500115you can also explore calculation groups
https://www.sqlbi.com/blog/marco/2020/07/15/creating-calculation-groups-in-power-bi-desktop/ - 5 years ago
Create a new table using Enter Data in the data view of Power BI desktop. In this table create two columns "Metric" containing your desired slicer options (Culture, Studies, Other) and an "Index" column containing the numbers 1 to 3. Using the Enter Data option means you can just type all this in. Name the table "Metric Selection".
In this new table create a measure:Selected Metric = SELECTEDVALUE( 'Metric Selection'[Metric] )Now you can create a measure that allows the user to toggle between the measures you have already created, depending on what they select from a slicer:
Culture, Studies Other Selection = SWITCH( TRUE() , 'Metric Selection'[Selected Metric] = "Culture", [Culture Occasions], 'Metric Selection'[Selected Metric] = "Studies", [Study hours] )You can use this measure in the values section of your charts, graphs and cards.
Create a new table using Enter Data in the data view of Power BI desktop. In this table create two columns "Metric" containing your desired slicer options (Culture, Studies, Other) and an "Index" column containing the numbers 1 to 3. Using the Enter Data option means you can just type all this in. Name the table "Metric Selection".
In this new table create a measure:
Selected Metric = SELECTEDVALUE( 'Metric Selection'[Metric] )
Now you can create a measure that allows the user to toggle between the measures you have already created, depending on what they select from a slicer:
Culture, Studies Other Selection =
SWITCH( TRUE() ,
'Metric Selection'[Selected Metric] = "Culture", [Culture Occasions],
'Metric Selection'[Selected Metric] = "Studies", [Study hours]
)
You can use this measure in the values section of your charts, graphs and cards.