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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply

Need help with using parameter in measure

How can I use a Parameter in measure 

Per Asset = CALCULATE(
    AVERAGE('cbdb alarm_occurences'[qty_alarms_7day]),
    'cbdb alarm_occurences'[grid_element_key]
        IN { "75e76b7c-19f3-4119-a043-859331e74c12" }
 
need to pass "75e76b7c-19f3-4119-a043-859331e74c12" as a parameter.
Can someone please help!!
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @parvathisuku_90 ,

 

We cannot use a parameter in a measure directly. To work around this requirement, we could create a query to store parameter value in a dataset, and then use this dataset value in your calculated measure. Please refer to the sample steps below.

 

1.Create a parameter in the Power Query Editor.

屏幕截图 2020-09-23 175159.png

 

2.Create a blank query and edit the query in Advanced Editor.

屏幕截图 2020-09-23 181205.png屏幕截图 2020-09-23 181036.png

 

3.Create a measure in your original table like below.

Per Asset = CALCULATE(
    AVERAGE('cbdb alarm_occurences'[qty_alarms_7day]),
    'cbdb alarm_occurences'[grid_element_key]=Max(Query1[Parameter]))
 
 
 

Best Regards,

Stephen Tao

 

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

3 REPLIES 3
Anonymous
Not applicable

Hi @parvathisuku_90 ,

 

We cannot use a parameter in a measure directly. To work around this requirement, we could create a query to store parameter value in a dataset, and then use this dataset value in your calculated measure. Please refer to the sample steps below.

 

1.Create a parameter in the Power Query Editor.

屏幕截图 2020-09-23 175159.png

 

2.Create a blank query and edit the query in Advanced Editor.

屏幕截图 2020-09-23 181205.png屏幕截图 2020-09-23 181036.png

 

3.Create a measure in your original table like below.

Per Asset = CALCULATE(
    AVERAGE('cbdb alarm_occurences'[qty_alarms_7day]),
    'cbdb alarm_occurences'[grid_element_key]=Max(Query1[Parameter]))
 
 
 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 
amitchandak
Super User
Super User

@parvathisuku_90 , Try like

calculate(AVERAGE('cbdb alarm_occurences'[qty_alarms_7day]),
'cbdb alarm_occurences'[grid_element_key]
IN { "75e76b7c-19f3-4119-a043-859331e74c12" })

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

This code is working perfectly

Per Asset = CALCULATE(
    AVERAGE('cbdb alarm_occurences'[qty_alarms_7day]),
    'cbdb alarm_occurences'[grid_element_key]
        IN { "75e76b7c-19f3-4119-a043-859331e74c12" }
But, my requirement is to pass "75e76b7c-19f3-4119-a043-859331e74c12' as a parameter to the measure. "75e76b7c-19f3-4119-a043-859331e74c12" is a sample value. I want to change this with the help of parameter.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors