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

Power BI Monthly Update - August 2025

Check out the August 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.