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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

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 and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.

Top Solution Authors