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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Jamming_Mon
Frequent Visitor

Power Query - Merging Multiple Columns and Removing Duplicates and unnecessary data in Columns

Hello,

 

I'm trying to merge multiple invoice columns into one.  Here's what I'm trying to do. 

1.  Remove Duplicate invoices found in all columns

2. Remove certain texts like TBD, Unknown etc and only include the Invoice Number

3. Remove the "INV" in the invoice text to only include the number

4. Merge data into one single Invoice Column.   

 

Included below is a screenshot of what I'm trying to accomplish.  

 

Invoice Duplicates Power Query.JPG

I tried exporting all duplicates and texts into excel so that I can just use the remove and replace feature in PBI, I quickly realized that I was looking at thousands of duplicates and texts and this was not reasonable. 

 

I think I may be able to remove the INV text by spliting column by custom delimiter "INV".  But if anyone knows of a simpler way through power query or trick, that will be really useful.  

 

Cheers!

 

1 ACCEPTED SOLUTION
mwegener
Most Valuable Professional
Most Valuable Professional

Hi @Jamming_Mon ,

 

Power Query:

 

1. Mark all columns and "Transform" --> "Unpivot Columns"

2. "Home" -->"Choose Colums" select "Value"

3. "Text Filters" on Column "Begins with..." = "INV"

4. "Transform" --> "Extract" --> "Text After Delimiter" = "INV"

5. "Home" --> "Remove Rows" --> "Remove Duplicates"

 

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


View solution in original post

3 REPLIES 3
mwegener
Most Valuable Professional
Most Valuable Professional

Hi @Jamming_Mon ,

 

Power Query:

 

1. Mark all columns and "Transform" --> "Unpivot Columns"

2. "Home" -->"Choose Colums" select "Value"

3. "Text Filters" on Column "Begins with..." = "INV"

4. "Transform" --> "Extract" --> "Text After Delimiter" = "INV"

5. "Home" --> "Remove Rows" --> "Remove Duplicates"

 

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


This worked, thanks! 🙂

amitchandak
Super User
Super User

@Jamming_Mon 

Try a new table like


Var _tab =distinct(union(all(Table[Invoice]),all(Table[Invoice]),all(Table[Invoice])))

return
selectcolumns(_tab,SUBSTITUTE("INV",[Invoice]))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Kudoed Authors