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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
plaralema
Advocate III
Advocate III

Help with conditional measure based on filter selection

 

Hello, i need some help with a measure, it has to be conditional depending on a filter selected

 

There are 4 elements: Copper, Zinc, Arsenic and Silver. (used as a PAGE filter, unique selection)

Measure is this:   

Chemical_composition_efect = (([Composition2023]-[Composition 2022])/100)*[Feed2023]*([Recovery2022]/100)
But it would only work for Copper and Arsenic, because composition 2023-2022 are in % unit, Zinc and Silver are in ppm base so measure should be if zinc or silver are selected.
Chemical_composition_efect = (([Composition2023]-[Composition 2022])/100000)*[Feed2023]*([Recovery2022]/100)
 
how can i create a measure with conditional based on a filter selected? thanks in advance.
1 ACCEPTED SOLUTION
lukiz84
Memorable Member
Memorable Member

Hi,

 

Chemical_composition_efect = 

VAR selected = SELECTEDVALUE(Element[Name]) 
VAR divisor = IF(selected = "Zinc" || selected = "Silver", 100000, 100)

RETURN
(([Composition2023]-[Composition 2022])/divisor)*[Feed2023]*([Recovery2022]/100)

 

 

 

where Element[Name] is your slicer, please change for your names 🙂

 

 

View solution in original post

2 REPLIES 2
plaralema
Advocate III
Advocate III

Thank you so much, it worked !! thanks a lot 😄 

lukiz84
Memorable Member
Memorable Member

Hi,

 

Chemical_composition_efect = 

VAR selected = SELECTEDVALUE(Element[Name]) 
VAR divisor = IF(selected = "Zinc" || selected = "Silver", 100000, 100)

RETURN
(([Composition2023]-[Composition 2022])/divisor)*[Feed2023]*([Recovery2022]/100)

 

 

 

where Element[Name] is your slicer, please change for your names 🙂

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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