Forum Discussion

actzikas's avatar
actzikas
Frequent Visitor
6 years ago
Solved

IF ELSE Statement for Column

I am trying to create an If Statement to create/group a column in the following order. 

If Probability < 50 then it is "Early" 

If Probability >= 50 or < 75 then it is "Warm" 

If Probability is > 75 then it is "Late" 

 

So far I have 

Piepline Probability Stage = IF(Opportunity[Probability] < 50, "Early", IF(Opportunity[Probability] >= 50 || Opportunity[Probability] < 75, "Warm", IF(Opportunity[Probability] >= 75, "Late")))

I know I need an else statement toward the end but can't seem to get it right. Thank you in advance! 
  • Hi actzikas 

    i dont think you need the last statement 

    IF(Opportunity[Probability] >= 75, "Late"

    because you have already described any of possible values.

    so, you could leave just

    Piepline Probability Stage = IF(Opportunity[Probability] < 50, "Early", IF(Opportunity[Probability] >= 50 || Opportunity[Probability] < 75, "Warm", "Late"))

5 Replies

  • VasTg's avatar
    VasTg
    Icon for Memorable Member rankMemorable Member

    actzikas 

     

    It is easier to create a calculated Column in Edit Queries/Transform Data.

     

     

    If this helps, accept it as a solution.

    Kudos are good too.

    • actzikas's avatar
      actzikas
      Frequent Visitor

      Thank you for the conditional column advise, but I wanted to do this via an IF Statement so I marked the other one as the solution but as you stated both work! 

  • az38's avatar
    az38
    Icon for Community Champion rankCommunity Champion

    Hi actzikas 

    i dont think you need the last statement 

    IF(Opportunity[Probability] >= 75, "Late"

    because you have already described any of possible values.

    so, you could leave just

    Piepline Probability Stage = IF(Opportunity[Probability] < 50, "Early", IF(Opportunity[Probability] >= 50 || Opportunity[Probability] < 75, "Warm", "Late"))
    • actzikas's avatar
      actzikas
      Frequent Visitor

      Thanks I just had to replace the || with && and it worked

  • dax's avatar
    dax
    Icon for Community Support rankCommunity Support

    Hi actzikas,

    If you want to create calculated column, you could try to follow above suggestions. Or you also could use below expression 

    Column = SWITCH(TRUE(),'Table'[Column1]<50, "a", 'Table'[Column1]<75, "b", 'Table'[Column1]>=75 ,"c")

     

    Best Regards,
    Zoe Zhi

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.