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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

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

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.