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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Syndicate_Admin
Administrator
Administrator

Conditional column

Hello!

Let's see if anyone can help me. I tell you:

I have a column named STEPNAME and another STATECODENAME.

I need to create a conditional column that meets the following:

1. [Statecodename] = "Won" ----> "Earned"

2. [Statecodename] = "Lost" ----> "Lost"

3. [Statecodename] = "Open" and [Stepname] = "3" ----> "Qualified"

4. [Statecodename] = "Open" and [Stepname] = "4" ----> "Qualified"

5. [Statecodename] = "Open" and [Stepname] = "5"----> "Qualified"

I had tried this formula, but the "Qualified" returns them to me as null and it is not correct:

= each if [statecodename] = "Canada" then "Canada"

else if [statecodename] = "Perdida" then "Perdida"

else if [statecodename] = "Abierta" & [Stepname] = "3" then "Cualificada"

else if [statecodename] = "Abierta" & [Stepname] = "4" then "Cualificada"

else if [statecodename] = "Abierta" & [Stepname] = "5" then "Cualificada"

else null)

I need this conditional column to put as a legend on a chart.

How can I make a formula that fulfills all this and that I get in a column those that are WON, LOST and QUALIFIED?

Thanks in advance and greetings!

1 ACCEPTED SOLUTION
johncolley
Solution Sage
Solution Sage

Hi,

 

The following calculated column logic works:

Calculated Col = 
IF(
Statecode[Statecodename] = "Won", "Won",
IF(Statecode[Statecodename] = "Lost", "Lost",
IF(Statecode[Statecodename] = "Open" && Statecode[Stepname] = 3, "Qualified",
IF(Statecode[Statecodename] = "Open" && Statecode[Stepname] = 4, "Qualified",
IF(Statecode[Statecodename] = "Open" && Statecode[Stepname] = 5, "Qualified", "Null")))))

Below is the returned results with some dummy data.

 

johncolley_0-1654041445261.png

 

View solution in original post

2 REPLIES 2
v-yalanwu-msft
Community Support
Community Support

Hi, @Syndicate_Admin ;

I think johncolley's answer is correct, here is a more concise method by the way.

 

Calculated Col =
SWITCH (
    Statecode[Statecodename],
    "Won", "Won",
    "Lost", "Lost",
    "Open",
        IF ( Statecode[Stepname] = 3 || [Stepname] = 4 || [Stepname] = 5, "Qualified" )
)


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

johncolley
Solution Sage
Solution Sage

Hi,

 

The following calculated column logic works:

Calculated Col = 
IF(
Statecode[Statecodename] = "Won", "Won",
IF(Statecode[Statecodename] = "Lost", "Lost",
IF(Statecode[Statecodename] = "Open" && Statecode[Stepname] = 3, "Qualified",
IF(Statecode[Statecodename] = "Open" && Statecode[Stepname] = 4, "Qualified",
IF(Statecode[Statecodename] = "Open" && Statecode[Stepname] = 5, "Qualified", "Null")))))

Below is the returned results with some dummy data.

 

johncolley_0-1654041445261.png

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.