Forum Discussion
Different Calculations
- 9 months ago
Hi margaretaak
This happens because Power BI visuals and DAX evaluate context differently.
When you drag a numeric field (e.g., Average of [Sales]) into a visual, Power BI averages all visible rows directly.
But when you use a DAX measure like:Row-based Average
Avg_Sales = AVERAGE('Table'[Sales])It averages within each filter or group in the visual ,not across all raw rows.
That’s why SUM gives identical results (it’s additive), but AVERAGE doesn’t ,it depends on the level of aggregation.
Context-based Average
Avg_Sales_ByCustomer = AVERAGEX( VALUES('Table'[Customer]), CALCULATE(SUM('Table'[Sales])) )In nut shell-The visual’s average is row-based, while your DAX measure is context-based. SUM matches; AVERAGE can differ because of grouping level.
For example:-
Sample data
1. Row-based Average-
This averages the Sales column over all visible rows in the current filter context.
If there are 3 rows (100, 300, 1000), it gives:
(100 + 300 + 1000) / 3 = 466.672. Context-based Average-
-
First, Power BI creates one row per Customer (A and B).
-
Then it calculates each customer’s total:
-
A → 100 + 300 = 400
-
B → 1000
-
-
Finally, it averages those totals: (400 + 1000) / 2 = 700
-
Hi @margaretaak,
As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided by community members for your issue worked for you or let us know if you need any further assistance?
Your feedback is important to us, Looking forward to your response
Thanks,
Prashanth