Forum Discussion
DAX Formula Compatibility Limitation
- 6 years ago
Hi,
Please try this:
ratio = SUM('Table'[value])/CALCULATE(SUM('Table'[value]),ALLSELECTED(Table))Best Regards,
Giotto Zhi
Hi,
Please try this:
ratio = SUM('Table'[value])/CALCULATE(SUM('Table'[value]),ALLSELECT(Table))Hope this helps.
Best Regards,
Giotto Zhi
- Lorenz336 years agoHelper IV
Hello Giotto,
I am still getting the same error (Function SUM is not allowed as part of calculated column DAX expressions on DirectQuery models). However, I am making Ratio like this:
Ratio = SUM(Table[Value])/CALCULATE(SUM(Table[Value2]),Table)
Because Power Bi is not recognizing ALLSELECT. Where does ALLSELECT come from? Please let me know. Thanks.
- v-gizhi-msft6 years agoCommunity Support
Hi,
I am sorry it's my mistake.
Please try to create a measure first:
measure = CALCULATE(SUM('Table'[Value2]),ALL(Table))Then create a calculated column:
Ratio = SUM(Table[Value])/[measure]Hope this helps.
Best Regards,
Giotto Zhi
- Lorenz336 years agoHelper IV
Hi Giotto,
Sorry for replying so late. In my testing I found that when I do:
measure = SUM(Table[Value2)
it returns the correct sum.
But when I do:
measure = CALCULATE(SUM('Table'[Value2]),ALL(Table))
I get a much greater value. Is it because the ALL statement might be summing that column for the entire table, instead of the filtered subset I am working with?