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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

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
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors
Top Kudoed Authors