This is best Fabric, Power BI, SQL and AI community event. How do we know? The last event sold out! Save €200 with code FABCMTY200.
Register nowA new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.
Hi,
I see different results when using either a measure or an aggregation as the expression to be evaluated in an AVERAGEX (or SUMX etc.).
With the following data:
Color Fruit Weight WeightType Green Apple 50 Dry Green Pear 60 Dry Red Strawberry 3 Dry Red Raspberry 1 Dry Red Pomegranate 50 Dry Green Apple 30 Wet Green Pear 60 Wet Red Strawberry 7 Wet Red Raspberry 4 Wet Red Granada 100 Wet
I'm running these measures:
AverageWeight_UsingSUM = AVERAGEX(VALUES(Table1[Fruit]), SUM(Table1[Weight])) AverageWeight_UsingMeasure = AVERAGEX(VALUES(Table1[Fruit]), [SumOfWeight]) SumOfWeight = SUM(Table1[Weight])
And get these results:
Now why exactly are the results different ? I guess probably because the context is evaluated differently, but I would have expected the same result...
Solved! Go to Solution.
Your example illustrates a couple of important points:
Comparing your two measures:
AverageWeight_UsingSUM
AverageWeight_UsingSUM = AVERAGEX ( VALUES ( Table1[Fruit] ), SUM ( Table1[Weight] ) )
AverageWeight_UsingMeasure
AverageWeight_UsingMeasure = AVERAGEX ( VALUES ( Table1[Fruit] ), [SumOfWeight] )
is equivalent to
AverageWeight_UsingMeasure = AVERAGEX ( VALUES ( Table1[Fruit] ), CALCULATE ( SUM ( Table1[Weight] ) ) )
AverageWeight_UsingSUM doesn't produce a sensible result, because leaving out CALCULATE means the row context of the table VALUES ( Table1[Fruit] ) is never converted to filter context, so the same SUM is evaluated for each value of Fruit, then averaged.
For example, at a grand total level, since the total sum of Weight is 365 and there are 6 Fruit values,
AverageWeight_UsingSUM = (365 + 365 + 365 + 365 + 365 + 365)/6 = 365
However AverageWeight_UsingMeasure produces a more sensible result because each row context of VALUES ( Table1[Fruit] ) is converted into a filter context (due to the implied CALCULATE) then the Weights are summed in the resulting filter context, then these sums are averaged.
For example, at a grand total level,
AverageWeight_UsingMeasure = (80 + 120 + 10 + 5 + 50 + 100)/6 = 60.83
Regards,
Owen
Your example illustrates a couple of important points:
Comparing your two measures:
AverageWeight_UsingSUM
AverageWeight_UsingSUM = AVERAGEX ( VALUES ( Table1[Fruit] ), SUM ( Table1[Weight] ) )
AverageWeight_UsingMeasure
AverageWeight_UsingMeasure = AVERAGEX ( VALUES ( Table1[Fruit] ), [SumOfWeight] )
is equivalent to
AverageWeight_UsingMeasure = AVERAGEX ( VALUES ( Table1[Fruit] ), CALCULATE ( SUM ( Table1[Weight] ) ) )
AverageWeight_UsingSUM doesn't produce a sensible result, because leaving out CALCULATE means the row context of the table VALUES ( Table1[Fruit] ) is never converted to filter context, so the same SUM is evaluated for each value of Fruit, then averaged.
For example, at a grand total level, since the total sum of Weight is 365 and there are 6 Fruit values,
AverageWeight_UsingSUM = (365 + 365 + 365 + 365 + 365 + 365)/6 = 365
However AverageWeight_UsingMeasure produces a more sensible result because each row context of VALUES ( Table1[Fruit] ) is converted into a filter context (due to the implied CALCULATE) then the Weights are summed in the resulting filter context, then these sums are averaged.
For example, at a grand total level,
AverageWeight_UsingMeasure = (80 + 120 + 10 + 5 + 50 + 100)/6 = 60.83
Regards,
Owen
Awesome..
Thank you !
Check out the May 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 27 | |
| 26 | |
| 22 | |
| 19 | |
| 17 |
| User | Count |
|---|---|
| 47 | |
| 46 | |
| 41 | |
| 21 | |
| 18 |