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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Parosel
Helper I
Helper I

IF one value then...

Hi, All

 

I've spent the day trying to figure out how to do this - I thought I was getting somewhere using SWITCH(TRUE() statement but can't seem to get it to work.

 

The situation is I have a measure which works out the percentage of activity, if the client hit's say 6.6% they will be paid 200 and so on. I even thought about building a table as such below but then couldn't figure out how to reference it (if it would even work?). I'm sure it can work - I just can't figure it out. If anyone can help it would be most appreciated. Thanks. 

6.6200
6.888372400
7.176744600
7.465116800
7.7534881000
8.041861200
8.3302331400
8.6186051600
8.9069771800
9.1953492000
2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@Parosel ,  Try a measure like

 

Sumx(Values(Table[Client]) , Calculate(Switch( True() ,

[Percent] >= 9.195349, 2000,

[Percent] >= 8.906977,1800,

//Add others

[Percent] >= 6.6 , 200

) ) )

 

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

@Parosel please consider accepting @amitchandak solution which is tecvhnically better than yours.

 

 @amitchandak shas wisely put the highest value first, because the switch command will trigger when it recahes the first >= true condition.

 

Whereas @Parosel has tested > and <.   

This is two times slower and will not be True when the value is =  

 

Well done @amitchandak  !

 

 

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Parosel ,  Try a measure like

 

Sumx(Values(Table[Client]) , Calculate(Switch( True() ,

[Percent] >= 9.195349, 2000,

[Percent] >= 8.906977,1800,

//Add others

[Percent] >= 6.6 , 200

) ) )

 

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak thanks for this I applied something similar

Estimated payment at current A&G Rate = SWITCH(
TRUE (),
AA_Measures[A&G to OP rate] > 0.066 && AA_Measures[A&G to OP rate] < 0.0688372, "£200",
AA_Measures[A&G to OP rate] > 0.0688372 && AA_Measures[A&G to OP rate] < 0.07176744186, "£400",
AA_Measures[A&G to OP rate] > 0.07176744186 && AA_Measures[A&G to OP rate] < 0.07465116279, "£600",
AA_Measures[A&G to OP rate] > 0.07465116279 && AA_Measures[A&G to OP rate] < 0.07753488372, "800",

@Parosel please consider accepting @amitchandak solution which is tecvhnically better than yours.

 

 @amitchandak shas wisely put the highest value first, because the switch command will trigger when it recahes the first >= true condition.

 

Whereas @Parosel has tested > and <.   

This is two times slower and will not be True when the value is =  

 

Well done @amitchandak  !

 

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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