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
obriaincian
Resolver I
Resolver I

DAX Create column based on conditions

Hi All,

 

PlatformDate1Date2
Apple12/01/2123/08/21
Sony12/11/2119/03/21
Apple09/10/2112/12/20
Microsoft09/08/2008/05/22

 

I am trying to create a simple custom column in Power BI but unfortuately I keep running into errors.

What I want to do is if the Platform is "Sony" or "Apple" populate Date1, otherwise populate Date2.

 

What I'm currently using is, but this isn't working

 

CustomerColumn = if 'Data'[Data.Platform]= "Sony" then 'Data'[Data.Date1] else if 'Data'[Data.Platform]= "Apple" then 'Data'[Data.Date1] else 'Data'[Data.Date2]

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@obriaincian , The above is Power Query. In DAX you can try like

 


CustomerColumn = Switch( True() ,
'Data'[Data.Platform]= "Sony" , 'Data'[Data.Date1] ,
'Data'[Data.Platform]= "Apple" , 'Data'[Data.Date1] ,
'Data'[Data.Date2])

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

1 REPLY 1
amitchandak
Super User
Super User

@obriaincian , The above is Power Query. In DAX you can try like

 


CustomerColumn = Switch( True() ,
'Data'[Data.Platform]= "Sony" , 'Data'[Data.Date1] ,
'Data'[Data.Platform]= "Apple" , 'Data'[Data.Date1] ,
'Data'[Data.Date2])

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