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
chrisbatson75
Frequent Visitor

Need Help with an "if" formula

I need help with an if Formual.  I have a colum that contains a value.  I need to "rate" that value based on if.

If MU Diff >0,1

If MU Diff > .5,2

If MU Diff >1,3

If MU Diff >2,4

otherwise 0

 

What is the DAX Equivleant of that?

1 REPLY 1
HotChilli
Super User
Super User

You're not too far away.

The syntax for nested IFs in DAX can begin to look messy but you just need some additional commas to separate the clauses.

More importantly, you need to reverse the IF clauses in this case because you will only get two value comparisons using the current order : is MU greater than 0? if yes, then return 1, and the second clause will never get tested for positive numbers e.g. if MU is 0.75

 

so the DAX should look something like

Column = if (MU Diff > 2, 4,
             IF (MU Diff > 1, 3,
                IF (MU Diff > 0.5, 2, 0)))

I deliberately missed a clause for you to put in

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.

Top Solution Authors