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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
AndyPBI
New Member

Need help with Power Query Add Column using multiple conditions

Hello, and thank you for reading:

There are 2 conditions that need to be met, for an end result.

 

if [priority] = "1 - Critical" and [major_incident] = "TRUE"
then "P1"
else if [priority] = "1 - Critical" and [major_incident] = "FALSE"
then "P5"
else null

 

My second statement "else if" overrides the first statement. What am I doing wrong?

More detail:

I ran the first statement alone, and it works as expected. It gives me the end result of "P1". However, when I run both the statements it replaces every row with "null" - and ignores the fact that the conditions for the first statement WERE met, but didn't reflect in my data.

 

How do I change my query to accomodate the first statement? 

Even more detail if needed:

This question will be called a success if I can accomplish the end goal of:
If a P1 is accompanied by a TRUE Major incident = P1
If a P1 is accompanied by a FALSE Major incident = P5


If a P2 is accompanied by a TRUE Major incident = P2

If a P2 is accompanied by a FALSE Major incident = P5. 

So on, so forth... all the way to a P4. And it has to be done all within 1 custom conditional column with 1 query. 
ANY time "major incident" is False, the end result must be "P5" 

Thank you for reading!! Any help here would be appreciated. I feel like I am very close but I have ran out of ideas.

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

pls try to change true and false to lower case.

 

= Table.AddColumn(#"Changed Type", "Custom", each if [priority]="1 - Critical" and [major_incident] =true then "p1" else if [priority]="1 - Critical" and [major_incident] =false then "p5" else null)

 

11.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

3 REPLIES 3
AndyPBI
New Member

Wow, well that was easy. THANK YOU SO MUCH!!!! @ryan_mayu 

you are welcome





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




ryan_mayu
Super User
Super User

pls try to change true and false to lower case.

 

= Table.AddColumn(#"Changed Type", "Custom", each if [priority]="1 - Critical" and [major_incident] =true then "p1" else if [priority]="1 - Critical" and [major_incident] =false then "p5" else null)

 

11.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors