Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
I have defined a field parameter which contains multiple measures. Users can select upto 3 measures using multi-select slicer.
I wish to have 3 different graph visuals showing the trends of the first, second and third selected measures from the slicer.
I tried to create individual measures such as SelectedMeasure1, SelectedMeasure2 and SelectedMeasure3 which I can insert into the y-axis section of the graph visual but somehow unable to get the correct DAX formula to get the visual. I dont wish to use the long switch statement as there are too many measures.
I can get the name of the measure by this formula:
Solved! Go to Solution.
Hi @imrankadri ,
Unfortunately, after testing and research.
I'm afraid the only other method other than this one is to create individual measures using SWITCH as you mentioned.
Just like this.
SelectedMeasure1 =
VAR measure_order = INDEX(1,VALUES('CheckKPIListLTE'[CheckKPIListLTE Order]))
RETURN
SWITCH(measure_order,
0,[Measure1],
1,[Measure2],
2,[Measure3],
3,[Measure4],
4,[Measure5]
)
Best Regards,
Dengliang Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks for the reply from rajendraongole1, please allow me to provide another insight.
Hi @imrankadri ,
Please refers to the following steps.
Add this custom visual: Preselected Slicer.
Creates a disconnected table containing the columns in the Field Parameters table.
Table2 = ALL(CheckKPIListLTE[CheckKPIListLTE],CheckKPIListLTE[CheckKPIListLTE Order])
Create a table with column values True and False for Preselected Slicer.
Creates a measure to be used for Preselected Slicer.
Measure =
VAR index = INDEX(1,VALUES('Table2'[CheckKPIListLTE Order]))
VAR selectedIndex = SELECTEDVALUE(CheckKPIListLTE[CheckKPIListLTE Order])
RETURN
IF(index = selectedIndex, TRUE(),FALSE())
Create a slicer using the Disconnect table field.
Create Preselected Slicer using the True/false field, the measure, and the field parameter table.
The final result is shown below.
The selection of the disconnect table slicer represents the measures in the field parameter table.
The Preselected Slicer dynamically selects the first selection of the Disconnected Table Slicer.
This makes the Y-axis of the chart dynamically use the first of several selected measures.
You can modify the measure to dynamically use the second or third measure.
Please see the attached pbix for reference.
Best Regards,
Dengliang Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Dear Dengliang Li
Thank you for taking out time and explaining it in detail. Does it mean that I need to create multiple preselected slicers, one for each graph and then keep each one's interaction only to the relevant graph?
Is this the only way?
Thanks
Imran Kadri
However, this method would require creating 15 different preselected slicers and then keeping their interaction with only one graph each. Also, this method would then
Hi @imrankadri ,
Unfortunately, after testing and research.
I'm afraid the only other method other than this one is to create individual measures using SWITCH as you mentioned.
Just like this.
SelectedMeasure1 =
VAR measure_order = INDEX(1,VALUES('CheckKPIListLTE'[CheckKPIListLTE Order]))
RETURN
SWITCH(measure_order,
0,[Measure1],
1,[Measure2],
2,[Measure3],
3,[Measure4],
4,[Measure5]
)
Best Regards,
Dengliang Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Dear @Anonymous
Yes, the switch method works fine. The only drawback being that I need to update all the measures each time I add a new KPI to my KPI list. But it seems like that I have to live with it.
Thanks for your help. Really appreciate.
Hi @imrankadri -Open Tabular Editor (external or built-in in Power BI).
Create a new calculation group named, for example, DynamicMeasures.
Create calculation items that reference the measures dynamically using a pattern like
CALCULATE(
SELECTEDMEASURE(),
'CheckKPIListLTE'[CheckKPIListLTE Fields] = "MeasureName1"
)
Use the calculation group with your field parameter to dynamically control measure evaluation without needing hardcoded logic, hope it works.
Proud to be a Super User! | |
Thanks @rajendraongole1 , I am done with the calculation group and calculation items creation. Could you please explain the below part in detail?
"Use the calculation group with your field parameter to dynamically control measure evaluation without needing hardcoded logic, hope it works."
I tried keeping the field parameter in y-axis of graph visual and calculation group in the filter section, but its not working.