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
Alisea_MI
Resolver II
Resolver II

Column with multiple nested ifs

Hi,

 

I am new to Dax and would appreciate help with writing a formula for a calculated column that returns the result in the column "EWS/Pack" in the table below.

 

Screenshot 2021-04-15 141122.jpg

The conditions are following:

IF [SampleSubTypeIDCode] contains text "Pack" AND [u_axflag] is "Null" or "N", expected outcome "Pack+N" else "Pack + Y",

IF [SampleSubTypeIDCode] contains text "EWS" AND [u_axflag] is "Null" or "N", expected outcome "EWS+N" else "EWS+ Y",

Else [SampleSubTypeIDCode]

 

Thank you so much in advance!

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Alisea_MI , You can not have 2 else to in if. So rethink on condition

I attempted like this a new column

 

 

Switch( True() ,
search("Pack",[SampleSubTypeIDCode],,0) >0 && (Isblank([u_axflag]) || [u_axflag] = "N") , "Pack+N" ,
search("Pack",[SampleSubTypeIDCode],,0) >0 , "Pack + Y" ,
search("EWS",[SampleSubTypeIDCode],,0) >0 && (Isblank([u_axflag]) || [u_axflag] = "N") , "EWS+N" ,
search("EWS",[SampleSubTypeIDCode],,0) >0 , "EWS+ Y" ,
[SampleSubTypeIDCode])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
Alisea_MI
Resolver II
Resolver II

Many thanks, @amitchandak ! Works perfect!

amitchandak
Super User
Super User

@Alisea_MI , You can not have 2 else to in if. So rethink on condition

I attempted like this a new column

 

 

Switch( True() ,
search("Pack",[SampleSubTypeIDCode],,0) >0 && (Isblank([u_axflag]) || [u_axflag] = "N") , "Pack+N" ,
search("Pack",[SampleSubTypeIDCode],,0) >0 , "Pack + Y" ,
search("EWS",[SampleSubTypeIDCode],,0) >0 && (Isblank([u_axflag]) || [u_axflag] = "N") , "EWS+N" ,
search("EWS",[SampleSubTypeIDCode],,0) >0 , "EWS+ Y" ,
[SampleSubTypeIDCode])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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