Forum Discussion
alice11987
2 years agoHelper 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:
Any ideas how I can achieve this in Power Query or DAX?
Thank you!
alice11987 Create a column using this dax:
DIFF =var _len1 = LEN('Table'[Column1]) + 1var _len2 = LEN('Table'[Column2])var _len = _len2-_len1returnRIGHT('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.
2 Replies
- ChiragGarg2512Solution Sage
alice11987 Create a column using this dax:
DIFF =var _len1 = LEN('Table'[Column1]) + 1var _len2 = LEN('Table'[Column2])var _len = _len2-_len1returnRIGHT('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. - ALLUREANSolution Sage
You can try this DAX approach. Create new calculated column:
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.