Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
imrankadri
Frequent Visitor

Using field parameter items as measures in separate visuals

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:

MeasureName1 = CALCULATE(INDEX(1, ALLSELECTED('CheckKPIListLTE'[CheckKPIListLTE Fields])))
 
But I cant get the measure itself by something like:
SelectedMeasure1 = 
CALCULATE(INDEX(1, ALLSELECTED('CheckKPIListLTE'[CheckKPIListLTE])))
 
Any help will be much appreciated.
1 ACCEPTED SOLUTION
Anonymous
Not applicable

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.

 

 

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

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.

vdengllimsft_0-1739787173250.png

 

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.

vdengllimsft_1-1739787452267.png

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.

vdengllimsft_2-1739787778403.png

 

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 

Anonymous
Not applicable

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.

rajendraongole1
Super User
Super User

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.





Did I answer your question? Mark my post as a solution!

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.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.