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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
krrish116
Resolver II
Resolver II

Change of Measure based on slicer selection

Hi @amitchandak ,

Please help me insorting out this...

I had a task :

i have 5 values (I&D, Olefins, Polyolefins, Refining, Technology) in a business segment column.

The business segments i have to show in a slicer.

for 5 values there are seperate measures

 and i get them all together in a single measure as below by using Variables.

 

Reliabilty % =
var Segment = SELECTEDVALUE('PlantArea'[Business Segment])
var IandD =CALCULATE([I&D Reliability%],'PlantArea'[Business Segment] = "I&D")
var Ole = CALCULATE([Olefins Reliability%],'PlantArea'[Business Segment] = "Olefins")
var Poly = CALCULATE([Poly Reliabilty %],'PlantArea'[Business Segment] = "Polyolefins")
var Ref = CALCULATE([Refining Reliability%],'PlantArea'[Business Segment] = "Refining")
var Tech = CALCULATE([Technology Reliability%],'PlantArea'[Business Segment] = "Technology")
return
IF(Segment = "I&D", IandD,
IF(Segment = "Olefins", Ole,
IF(Segment = "Polyolefins", Poly,
IF(Segment = "Refining", Ref,
IF(Segment = "Technology", Tech)))))

 

I have kept the slicer as single select so now they can select any one and it is working fine.

Now the problem is they want multiselect and if they select 2 values then it will show average of the 2 measures selected.

Please let me know how to create average, if they select 2 values in business segment slicer.

 

Thanks,

Krish..

 

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

It's weird because on my test sample it works just fine...

Try this measure:

Reliabilty % =
var tempTable=ADDCOLUMNS(VALUES('PlantArea'[Business Segment]),"_value"
SWITCH('PlantArea'[Business Segment];
"I&D", [I&D Reliability%],
"Olefins", [Olefins Reliability%],
"Polyolefins", [Poly Reliabilty %],
"Refining", [Refining Reliability%],
"Technology", [Technology Reliability%])
)
return
AVERAGEX(tempTable,[_value])

View solution in original post

Thanks alot it is working..

 

View solution in original post

8 REPLIES 8
Anonymous
Not applicable

@krrish116 Try this:

Reliabilty % =
var IandD =CALCULATE([I&D Reliability%],'PlantArea'[Business Segment] = "I&D")
var Ole = CALCULATE([Olefins Reliability%],'PlantArea'[Business Segment] = "Olefins")
var Poly = CALCULATE([Poly Reliabilty %],'PlantArea'[Business Segment] = "Polyolefins")
var Ref = CALCULATE([Refining Reliability%],'PlantArea'[Business Segment] = "Refining")
var Tech = CALCULATE([Technology Reliability%],'PlantArea'[Business Segment] = "Technology")
var tempTable=ADDCOLUMNS(VALUES('PlantArea'[Business Segment]),"_value",
IF('PlantArea'[Business Segment]"I&D"IandD,
IF('PlantArea'[Business Segment]"Olefins"Ole,
IF('PlantArea'[Business Segment]"Polyolefins"Poly,
IF('PlantArea'[Business Segment]"Refining"Ref,
IF('PlantArea'[Business Segment]"Technology"Tech)))))
)
return
AVERAGEX(tempTable,[_value])

@Anonymous It is not working ..

Please help me to sortout this

Anonymous
Not applicable

How exactly it's not working? Some errors or anything?

No Errors Sir as of now..

but if i select 2 values in slicer then it is coming blank. it is not showing Average.

Olefins Selected

krrish116_0-1635236997745.png

Poly Olefins selected

krrish116_1-1635237030319.png

If i select 2 then it is not showing Average it is showing blank

krrish116_2-1635237103110.png

 

Anonymous
Not applicable

It's weird because on my test sample it works just fine...

Try this measure:

Reliabilty % =
var tempTable=ADDCOLUMNS(VALUES('PlantArea'[Business Segment]),"_value"
SWITCH('PlantArea'[Business Segment];
"I&D", [I&D Reliability%],
"Olefins", [Olefins Reliability%],
"Polyolefins", [Poly Reliabilty %],
"Refining", [Refining Reliability%],
"Technology", [Technology Reliability%])
)
return
AVERAGEX(tempTable,[_value])

Thanks alot it is working..

 

amitchandak
Super User
Super User

@krrish116 , if 'PlantArea'[Business Segment] joined with table having (or is the same tbale)

Then this should work

CALCULATE([I&D Reliability%])

 

I am really not sure on need of 5 meaures, you can try like this too.

CALCULATE([I&D Reliability%],filte('PlantArea', 'PlantArea'[Business Segment] in allselected('PlantArea'[Business Segment]) ) )

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

For all 5 Business Segments the measures are different for some business segments im using 2 columns for some im using 3 columns to multiply and divide to get the %

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.

Top Solution Authors