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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
S_Harmon
New Member

Return value in column if it contains a specific value, if not return value in a different column

Hi,

 

Im trying to create the "New Department" column where it looks for "Machine Shop" or "Charge Shop" in the Supplier column and returns those values if it contains one of those values. If it doesnt, it needs to return the value from the "Department" Column.

 

Can anyone please help?

 

DateNCRNCR TYPEWOPOSUPPLIERPART NUMBERQUANTITYDEPARTMENT New Department
8/1/20241Internal101  ABC 11Assembly Assembly
8/1/20242Internal102 Machine ShopABC 23Assembly Machine Shop
8/10/20243Internal103 Machine ShopABC 17Assembly Machine Shop
8/15/20244Supplier P101Supplier XABC 54Receiving Receiving
8/15/20245Internal104  ABC 28Assembly Assembly
8/15/20246Supplier P102Supplier XABC 45Assembly Assembly
8/15/20247Supplier P103Supplier XABC 23Receiving Receiving
8/20/20248Internal105  ABC 36Assembly Assembly
8/25/20249Internal106  ABC 32Assembly Assembly
8/30/202410Internal107 Charge ShopABC 43Assembly Charge Shop
1 ACCEPTED SOLUTION
rsbin
Super User
Super User

@S_Harmon ,

Please try this as a Calculated Column in DAX:

NewDepartment = SWITCH(
                    TRUE(),
                [Supplier] IN { "Machine Shop", "Charge Shop" }, [Supplier],
                [Department] )

 Else you could do an if function in Power Query as well.

Regards,

View solution in original post

2 REPLIES 2
rsbin
Super User
Super User

@S_Harmon ,

Please try this as a Calculated Column in DAX:

NewDepartment = SWITCH(
                    TRUE(),
                [Supplier] IN { "Machine Shop", "Charge Shop" }, [Supplier],
                [Department] )

 Else you could do an if function in Power Query as well.

Regards,

That worked! Thank you so much! I was way over thinking that for some reason.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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