Forum Discussion

cristianml's avatar
cristianml
Post Prodigy
6 years ago
Solved

IF OR AND expression correction

Hi, Could you help me to correct the following expression according to the table below? I don't see where is the the mistake: Thanks!
  • lbendlin's avatar
    6 years ago

    switch(true

    ,[Var CCI]<=-100000 || [Var CCI %]<=-.01,"High"

    ,[Var CCI]<=-50000 && [Var CCI %]<=-.01,"Medium"

    ,[Var CCI]>=-50000 && [Var CCI %]<=0,"Low"

    ,"Green")

     

     

    I don't think you can use "%"  in your comparisons.

  • Sunil2020's avatar
    6 years ago

    Hi

    I'm also new to Power BI. But observed something incorrect with the logic of the requirement you posted - there seems to be 2 anomalies in it. 

    1) Unless you move the Medium risk portion of the formula above the High Risk portion, Medium risk will never be tagged to any record as you have "VAR CCI %" <= -1% with the OR clause in the High risk definition while this is part of Medium risk definition with an And Clause. 

    2) Var CCI = -50K (equal to 50K) is part of both Medium as well as low risk definition. You need to exclude it from one of them.

     

    Regards

    Sunil