Forum Discussion
Anonymous
9 years agoNot applicable
How to create reusable function
Hello, I would like to create a reusable function and I cannot find a way to do that. Is it even possible? Here is my use-case. I have several columns e.g., "Score A" and "Score B" with scores th...
- Anonymous9 years ago
Eventually I created an M function following the tutorial here.
v-chuncz-msft
9 years agoCommunity Support
Anonymous,
Instead of calculated column in DAX, you could add column in Query Editor as well.
Anonymous
9 years agoNot applicable
Yes you are right but DAX is much simpler than M when it comes to complex functions, even not so complex, simple if statements, or a SWITCH in M is alsmost impossible to do.
In my case the score that I want to calculate is a logarithm based on values of other columns. Anyways thanks for helping!
- v-chuncz-msft9 years agoCommunity Support
Anonymous,
You may use the GENERATE Function similar to the CROSS APPLY condition in SQL.
Table = GENERATE ( X, UNION ( ROW ( "Attribute", "Score A", "Value", X[Score A] ), ROW ( "Attribute", "Score B", "Value", X[Score B] ) ) )