Forum Discussion
nirrobi
8 years agoHelper V
Find the difference between 2 columns PQ / DAX
Hi all , I have table similar to the below. I need to have have column that check if column 2 & 3 are identical - easy I also need to have column that show the differnce between the columns e....
- Anonymous8 years ago
Hi nirrobi,
You can add a custom column in Query Editor:
if ([Column1] = [Column2]) then "identical" else if (Text.Length([Column1]) > Text.Length([Column2])) then Text.Replace([Column1], [Column2], "") &"- missing "& Text.Replace([Column1], [Column2], "") else if (Text.Length([Column1]) < Text.Length([Column2])) then Text.Replace([Column2], [Column1], "") &"- additional "& Text.Replace([Column2], [Column1], "") else ""
This solves everything except point 5 in your example, but it's a good approach.
Regards.
Anonymous
8 years agoNot applicable
Hi nirrobi,
You can add a custom column in Query Editor:
if ([Column1] = [Column2]) then "identical" else if (Text.Length([Column1]) > Text.Length([Column2])) then Text.Replace([Column1], [Column2], "") &"- missing "& Text.Replace([Column1], [Column2], "") else if (Text.Length([Column1]) < Text.Length([Column2])) then Text.Replace([Column2], [Column1], "") &"- additional "& Text.Replace([Column2], [Column1], "") else ""
This solves everything except point 5 in your example, but it's a good approach.
Regards.