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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote 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

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.