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! Learn more

Reply
am_i_really
Frequent Visitor

Switch statement based on another measure

Hi All, 

 

I'm trying to write a measure that will give me a specific value based on the result of another measure. I have the following measure "NON-PM Score = DIVIDE([NON-PM On Time], [NON-PM Total])" that gives me a percentage. Based on this percentage I am trying to write a measure that will give me a number 1-5. This is what I was trying to use but it doesnt not work:

Measure = SWITCH(
    TRUE(),
    'Measures Table'[NON-PM Score] > .95, "5",
    'Measures Table'[NON-PM Score] > .89 < .95, "4",
    'Measures Table'[NON-PM Score] > .79 < .90, "3",
    'Measures Table'[NON-PM Score] > .69 < .80, "2",
    'Measures Table'[NON-PM Score] < .70 , "1"
)

What I basically need is for the measure for show a
5: 95% and higher
4: 90 - 94.9%

3: 80 - 89.9%

2: 70 - 79.9%
1: anything less than 70%


Thank you in advance!

1 REPLY 1
Greg_Deckler
Community Champion
Community Champion

@am_i_really Hard to say why it isn't working. You could simplify it and get better performance this way. Perhaps provide sample data and a description of what is going wrong.

Measure = 
  VAR __Measure = 'Measures Table'[NON-PM Score]
  SWITCH(
    TRUE(),
    __Measure < .7, "1",
    __Measure > .69 < .80, "2",
    __Measure > .79 < .90, "3",
    __Measure > .89 < .95, "4",
    "5"
  )


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

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.