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
dhodgson
Frequent Visitor

Replace Column Values

Hi, 

 

I need to be able to replace all the values in the 'Trade Engagement' column to look like the below when 'EmployeeID' is NOT "1.Subcontractor" or blank. 

 

EmployeeIDTrade Engagement
CARLCompany
1.Subcontractor1.Subcontractor
ADAMCompany
  
JAMESCompany

 

Thanks in advance

1 ACCEPTED SOLUTION

btw, the first reply is for DAX, it works like:

FreemanZ_2-1681268614012.png

View solution in original post

5 REPLIES 5
FreemanZ
Super User
Super User

hi @dhodgson 

not very clear. do you mean something like:

Column =
IF(
    [EmployeeID] IN {"1.Subcontractor", BLANK()},
    [Trade Engagement],
   "Company"
)

That forumla isn't wokring. All I did was duplicate the EmployeeID column and renamed to 'trade engagement'. I then need to replace all values to 'Company' if they are not 1.subcontractor or a blank field. I tried using the below, however it replaces all text with "Company"; 

 

= Table.ReplaceValue(#"Renamed Columns1", each [Trade Engagement], each if [employeeid] <> "1.SUBCONTRACTOR" then "Company" else [Trade Engagement], Replacer.ReplaceText,{"Trade Engagement"})

btw, the first reply is for DAX, it works like:

FreemanZ_2-1681268614012.png

Apoloigies, was definitley doing this one wrong! This helps. Appreciate it. 

hi @dhodgson 

try to add a custom column like:

= Table.AddColumn(#"Changed Type", "Custom", each if [EmployeeID] ="1.Subcontractor" or [EmployeeID]=" "
then [EmployeeID]
else "Company")

 

it worked like:

FreemanZ_0-1681268353212.png

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.