Forum Discussion

Rajamanikandan's avatar
Rajamanikandan
New Member
4 years ago
Solved

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

 

But it is incorrect if any record meets on ELSE condition

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

2 Replies

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

    • Rajamanikandan's avatar
      Rajamanikandan
      New Member

      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"