Forum Discussion
Summarzing a table variable?
- 8 years ago
In DAX, it can't determine the current context since the row context is not generated yet when resolving the expression. You have to use a calculated column formula to calculate the results.
For your requirement, I think the easiest way is creating a calculated table instead of table variable. Then summarize this calculated table.
Regards,
- 8 years ago
fyi - if anyone is looking at this facing the same challenge, it can be solved easily using GROUPBY and CURRENTGROUP().
EVALUATE VAR cars = DATATABLE( "Maker", STRING, "Sales", INTEGER, { { "Ford", 300 }, { "Jaguar", 180 }, { "Jaguar", 1 } }) RETURN GROUPBY( cars, [Maker], "total sales", SUMX(CURRENTGROUP(),[Sales]) )
In DAX, it can't determine the current context since the row context is not generated yet when resolving the expression. You have to use a calculated column formula to calculate the results.
For your requirement, I think the easiest way is creating a calculated table instead of table variable. Then summarize this calculated table.
Regards,
Can you explain this like im 5? What does it mean to generate row context when resolving the expression?
What is a calculated column formula vs the table variable? What is a calculated table and how is that different from calculated column and a table variable?
Thank you!
- dg1234567893 years agoAdvocate III
Welcome to the PowerBi community. Where all answers are extremely vague and without context and most "Solved" questions are to "please post this question as a new feature so i can mark this as solved even there is no actual answer"