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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Rajamanikandan
New Member

Need Help on DAX - SWITH / IF Function results incorrect

Comparing two measures [Ref CY], [Ref PY] and deriving a custom tag for each record.

 

The calculation below works well for some scenarios but incorrectly calculates if it meets "ELSE" condition records. Any suggestion would be much appreciated.

 

Priority =

    IF

    (   AND

        ( [Ref CY]=0,[Ref PY]=0),"C",

        IF

        ( AND ([Ref CY]=0,[Ref PY]>=1),"b",

        "B")

    )

 

Priority Alt =

SWITCH

(

    TRUE,           

    (([Ref CY]=0) && ([Ref PY]=0)), "C",

    (([Ref CY]=0) && ([Ref PY]>=1)), "b",   

    "B"

)

 

 

The calculation works well

Pic1.JPG

 

But it is incorrect if any record meets on ELSE condition

Pic2.JPG

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

Power BI is not case sensitive. "B" and "b" will be grouped together in the UI.

View solution in original post

2 REPLIES 2
lbendlin
Super User
Super User

Power BI is not case sensitive. "B" and "b" will be grouped together in the UI.

Thank you. You saved me. It works.

I need to research how it's grouped together and learn more. Added space to achieve the result.

 "DAX is simple but not easy"

 

DAX1.png

Helpful resources

Announcements
November Fabric Update Carousel

Fabric Monthly Update - November 2025

Check out the November 2025 Fabric update to learn about new features.

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!

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.

Users online (25)