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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
alice11987
Helper I
Helper I

Remove duplicate text between columns

In Power Query, I would like to get the column [Result] based on Column A and Column B. 

In Column A and Column B, there are duplication of texts, I would like to extract the part without duplications: 

alice11987_0-1696912862375.png

Any ideas how I can achieve this in Power Query or DAX?

 

Thank you!

1 ACCEPTED SOLUTION
ChiragGarg2512
Solution Sage
Solution Sage

@alice11987 Create a column using this dax:

DIFF =
var _len1 = LEN('Table'[Column1]) + 1
var _len2 = LEN('Table'[Column2])
var _len = _len2-_len1
return
RIGHT('Table'[Column2], _len)
 
This would take the length of string in Column A and remove the length from Column B giving the length of desired string in Column C and RIGHT will take the right part of string of that length.
ChiragGarg2512_0-1696918184915.png

 

View solution in original post

2 REPLIES 2
ChiragGarg2512
Solution Sage
Solution Sage

@alice11987 Create a column using this dax:

DIFF =
var _len1 = LEN('Table'[Column1]) + 1
var _len2 = LEN('Table'[Column2])
var _len = _len2-_len1
return
RIGHT('Table'[Column2], _len)
 
This would take the length of string in Column A and remove the length from Column B giving the length of desired string in Column C and RIGHT will take the right part of string of that length.
ChiragGarg2512_0-1696918184915.png

 

ALLUREAN
Solution Sage
Solution Sage

You can try this DAX approach. Create new calculated column:

Remove duplicate text between columns DAX.png

In your example you are not taking into account the pure difference and in my case this will give underscore _ that can be removed if you like. I hope that this will be easy to be replicated in PQ, but for the moment I am not aware what is the functions there.




Did I answer your question? Mark my post as a solution!


https://allure-analytics.com/
https://www.youtube.com/channel/UCndD_QZVNB_JWYLEmP6KrpA
https://www.linkedin.com/company/77757292/

Proud to be a Super User!




Helpful resources

Announcements
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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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