Forum Discussion
ryan_b_123
2 years agoFrequent Visitor
Using value from column to affect calculation in Power Query
Col 1 Col 2 Col 3 Desired Result 4 + 5 9 3 - 2 1 Let's say I have above dataset: To do above, I could write a formula in Power QUery something like "if [col 2] = "+" then [C...
- 2 years ago
Yes, there is a way.
Use Expression.Evaluate
You can build a string from the first 3 columns ( either by appending with & or use Text.Combine and then just pass that to Expression.Evaluate()
HotChilli
2 years agoCommunity Champion
There's nothing wrong with the "="
See the 3rd example
https://learn.microsoft.com/en-us/powerquery-m/expression-constant#example-3
You need Expression.Constant
ryan_b_123
2 years agoFrequent Visitor
Thanks for the reply, but could you be a bit more specific how Expression.Constant is used? Is this wrapped inside of the Expression.Evaluate?
The documenation is extremely short on this function and I do not know what it does exactly.