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! Learn more

Reply
Anonymous
Not applicable

How to create custom column with multiple ''IF'' ''AND'' ''THEN''

Hi

How to create custom column with multiple ''IF'' ''AND'' ''THEN'' statements in power query.

i am trying to write this formula in query editor.

if [PLANTS]="DDDD” and [PLANTS1]="MUMBAI" then "A"

else if [PLANTS.<>"DDDD" and [PLANTS1]="MUMBAI" and [CODE]=" PARTS" then "B"

else if PLANTS]<>"DDDD" and [PLANTS1]="MUMBAI" and [CODE]<>"PARTS1" then "C"

Kindly guide.

 

Thanks

Kavitha

 

5 REPLIES 5
FrankAT
Community Champion
Community Champion

Hi,

take a look at your code, I think you have some typo:

 

typo.png

 

1: "]" instead of "."

2: leading Blank

3: missing "["

 

Regards FrankAT

Anonymous
Not applicable

Hi FrankAT

This one is sample formula..i used this in excel query table.now i want to use the same formule in query table..is this possible in custom column with multiple ''if''''and '' statements.

 

Thanks

Kavitha

Anonymous
Not applicable

USE SWITCH() FUNCTION

 

https://docs.microsoft.com/en-us/dax/switch-function-dax

 

Thanks & regards,
Pravin Wattamwar
www.linkedin.com/in/pravin-p-wattamwar

If I resolve your problem Mark it as a solution and give kudos.

Anonymous
Not applicable

Hi

Thanks for ur reply. where should i apply this DAX function..is there any option in the home Ribbons...

Thanks again

Kavitha

Anonymous
Not applicable

you can not have home ribbons for and conditions.

 

You can simply write same formull if this then this. but it will make your code little bit complex.

Simply use switch(). if you are ok with if then write it like below

new column= if([PLANTS]="DDDD” &&[PLANTS1]="MUMBAI","A", if([PLANTS]<>"DDDD” && [PLANTS1]="MUMBAI","B",

if([PLANTS]<>"DDDD” && [PLANTS1]<>"MUMBAI","C")))

 

Thanks & regards,
Pravin Wattamwar
www.linkedin.com/in/pravin-p-wattamwar

If I resolve your problem Mark it as a solution and give kudos.

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.