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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
wackojacko1979
Regular Visitor

Replace text in cell if cells in other columns contain specific text

Hi All,

First time poster, very new to Power BI and Power Query.

My issue is as follows:

Due to incorrect data entry (outside of my control), some cells are showing an incorrect value. See CorrectedPackage column.

I wish to search 3 seperate columns, Package.5, Package.6 and Package.7, for multiple specific text values, (COLO, BAS, AHU, etc).

If these values are returned, I wish to replace current text, MECH, in CorrectedPackage column with BAS.

 

I have done some searching, and there seems to be multiple options that will get me close, but nothing I have found that works correctly, or that I can edit (clumsily) to make work!

 

Thanks in Advance!

 

CorrectedPackaged.png

1 REPLY 1
ITManuel
Responsive Resident
Responsive Resident

Hi @wackojacko1979 ,

 

welcome to the community.

 

If I understood you correctly:

 

1. Merge Package5. Package6. and Package7. into one column only --> ( This will make life easier for searching specific text in 1 column only rater than in 3. I have named the column " Package567"

2. Add calculated column "CorrectedPackage" with DAX and use the following code 

 

CorrectedPackage = 
SWITCH ( 
    TRUE (),
    CONTAINSSTRING ( 'Table'[Package567], "COLO" ), "BAS",
    CONTAINSSTRING ( 'Table'[Package567], "BAS" ), "BAS",
    CONTAINSSTRING ( 'Table'[Package567], "AHU" ), "BAS",
    CONTAINSSTRING ( 'Table'[Package567], "Any other value you want to check" ), "BAS",
    'Table'[Package]
)

 

Hope this helps.

 

Best regards

Helpful resources

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

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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