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

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! 
1 ACCEPTED SOLUTION
az38
Community Champion
Community 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"))

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

5 REPLIES 5
dax
Community Support
Community 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")

507.PNG 

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.

az38
Community Champion
Community 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"))

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
actzikas
Frequent Visitor

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

VasTg
Memorable Member
Memorable Member

@actzikas 

 

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

 

Cap11.PNG

 

If this helps, accept it as a solution.

Kudos are good too.

Connect on LinkedIn

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! 

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.