Forum Discussion
Multiple Measures Slicer
- 5 years ago
Hi HenryJS ,
You may create a table 'SlicerTable' via the button "Enter Data", type all of the measures' names in one column named "MeasureName" one by one, and put this column [MeasureName] into slicer to filter data.
Then you may create a measure like DAX below, put it into Values box of chart visual.
SelectedMeasure= SWITCH( SELECTEDVALUE('SlicerTable'[MeasureName]), "Candidate Calls" ,[Candidate Calls], "Client Calls" ,[Client Calls], … )Best Regards,
Amy
Community Support Team _ Amy
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- 5 years ago
As has been suggested, you need a disconnected table listing the measure names. To make the "slicer" multiselectable (is that a word?), you need to create new measures for each of the measures listed.
For the following example I'm using a simple dataset and the idea is to display a selectable combination of 4 measures.
1) first create the table using the "Enter Data" option in the Home tab (I've called the table 'Select Measure'):
2) Create a measure to check if a filter has been applied:
Countrows Select Measure = IF(ISFILTERED('Select Measure'[Selected Measure]), COUNTROWS(VALUES('Select Measure'[Selected Measure])), BLANK())You can also use this measure to create conditional title/text meassage as a warning to users to make a selection:
Warning = IF(ISBLANK([Countrows Select Measure]), "Please Select at Least One Measure!!")3) Create a new measure for each measure you wish to display which is referenced to the slicer table following the code:
Sales 2018 (sel) = VAR calc = COUNTROWS( FILTER('Select Measure', 'Select Measure'[Selected Measure]= "Sales 2018")) RETURN IF(ISBLANK([Countrows Select Measure]), BLANK() , IF(calc= 1, [Sales 2018], BLANK()))You can then build your report page with the slicer, and the line chart visual using these new measures as your "Values".
As has been suggested, you need a disconnected table listing the measure names. To make the "slicer" multiselectable (is that a word?), you need to create new measures for each of the measures listed.
For the following example I'm using a simple dataset and the idea is to display a selectable combination of 4 measures.
1) first create the table using the "Enter Data" option in the Home tab (I've called the table 'Select Measure'):
2) Create a measure to check if a filter has been applied:
Countrows Select Measure =
IF(ISFILTERED('Select Measure'[Selected Measure]),
COUNTROWS(VALUES('Select Measure'[Selected Measure])),
BLANK())
You can also use this measure to create conditional title/text meassage as a warning to users to make a selection:
Warning = IF(ISBLANK([Countrows Select Measure]), "Please Select at Least One Measure!!")
3) Create a new measure for each measure you wish to display which is referenced to the slicer table following the code:
Sales 2018 (sel) =
VAR calc = COUNTROWS(
FILTER('Select Measure',
'Select Measure'[Selected Measure]= "Sales 2018"))
RETURN
IF(ISBLANK([Countrows Select Measure]),
BLANK() ,
IF(calc= 1, [Sales 2018],
BLANK()))
You can then build your report page with the slicer, and the line chart visual using these new measures as your "Values".
Hey, I love the solution! It worked great for me with one kink...how can I hide the measures not being selected from the visual? (highlighted below)
I'm using this method in a matrix format, and when I unselect the measure it hides the data from showing but the row label still exists (actual company numbers covered here)