Forum Discussion
Anonymous
2 years agoNot applicable
Comparison operator saved in Cell - How to use?
Hi all, I have two columns that I need to compare and the comparison operator is saved in a third column. I am not sure how to write the query to use the operator that is saved in the cells ...
- Anonymous2 years ago
Hi Anonymous
Thanks for the reply from amitchandak , please allow me to provide another insight:
I create a set of sample:
Then add a calculate column:
Column = SWITCH ( TRUE (), 'Table'[Value1] > 'Table'[Value2] && FIND ( ">", 'Table'[Operator],, BLANK () ) <> BLANK (), "True", 'Table'[Value1] = 'Table'[Value2] && FIND ( "=", 'Table'[Operator],, BLANK () ) <> BLANK (), "True", 'Table'[Value1] < 'Table'[Value2] && FIND ( "<", 'Table'[Operator],, BLANK () ) <> BLANK (), "True", "False" )The result is as follow:
Best Regards
Zhengdong Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amitchandak
Super User
2 years agoAnonymous , Try Expression.Evaluate in power query
New column in power query, assuming you have three columns with col2 as CheckParameter
Expression.Evaluate([Col1] & " " & [CheckParameter] & " " & [Col3])