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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register 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.

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
Top Kudoed Authors