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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live 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
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.