Forum Discussion
Concat two Text.Length in if statement (combine text.length's of two columns if not equal)
Why do these give an error:
= Table.AddColumn(#"Changed Type, "COMPARE", each if[TEXT]<>[TEXT.1] then Text.Length([TEXT]) &" vs. "& Text.Length([TEXT.1]) else "=")
= Table.AddColumn(#"Changed Type, "COMPARE", each if[TEXT]<>[TEXT.1] then Text.Combine({Text.Length([TEXT]), Text.Length([TEXT.1])}, " vs. ") else "=")
= Table.AddColumn(#"Changed Type, "COMPARE", each if[TEXT]=[TEXT.1] then "=" else Text.Length([TEXT]) &" vs. "& Text.Length([TEXT.1]))
= Table.AddColumn(#"Changed Type, "COMPARE", each if[TEXT]=[TEXT.1] then "=" else Text.Combine({Text.Length([TEXT]), Text.Length([TEXT.1])}, " vs. "))
Alternatives? (I want to be able to "see" the diff between 2 text columns.)
- Anonymous5 years ago
it would have been easier to help you if you had written the error it gives you for each of the expressions.
For example, for the former, the problem could be that Power Query cannot concatenate numbers and text.
For this you should convert the numeir to text. Thus, for example:
= Table.AddColumn(#"Changed Type, "COMPARE", each if[TEXT]<>[TEXT.1] then Text.From(Text.Length([TEXT])) &" vs. "& Text.From(Text.Length([TEXT.1])) else "=")
...
2 Replies
- AnonymousNot applicable
it would have been easier to help you if you had written the error it gives you for each of the expressions.
For example, for the former, the problem could be that Power Query cannot concatenate numbers and text.
For this you should convert the numeir to text. Thus, for example:
= Table.AddColumn(#"Changed Type, "COMPARE", each if[TEXT]<>[TEXT.1] then Text.From(Text.Length([TEXT])) &" vs. "& Text.From(Text.Length([TEXT.1])) else "=")
...
- ooptennoort
Advocate I
You're right (of course)!! (Still learning)
Expression.Error: We cannot apply operator & to types Number and Text.