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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
Alicia83B
Helper I
Helper I

Replace Values in Power Query Based on Conditions

I have an Opportunities Table with a column for Territory and Seller. I currently am replacing Mary’s territory from 1 to 16 using the below formula.

= Table.AddColumn(#"Changed Type1", "Chng Territory", each if [Assigned To] = "Mary" and [Territory] >=1 then "16" else [Territory])

However, I have two more sellers, Tim and Robin, that I need to add to the formula, but get an error message when I add “Mary” or “Tim” or “Robin” to my above formula.

Thank you in advance for taking a look at this and providing any help.

1 ACCEPTED SOLUTION
Vijay_A_Verma
Most Valuable Professional
Most Valuable Professional

Replace if condition with either of these (2nd one is useful if you have many names)

if ([Assigned To] = "Mary" or [Assigned To] = "Tim" or [Assigned To] = "Robin") and [Territory] >=1 then "16" else [Territory]

if List.Contains({"Mary","Tim","Robin"},[Assigned To]) and [Territory] >=1 then "16" else [Territory]

View solution in original post

2 REPLIES 2
Alicia83B
Helper I
Helper I

Thank you @Vijay_A_Verma  for your help! 

Vijay_A_Verma
Most Valuable Professional
Most Valuable Professional

Replace if condition with either of these (2nd one is useful if you have many names)

if ([Assigned To] = "Mary" or [Assigned To] = "Tim" or [Assigned To] = "Robin") and [Territory] >=1 then "16" else [Territory]

if List.Contains({"Mary","Tim","Robin"},[Assigned To]) and [Territory] >=1 then "16" else [Territory]

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.