Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
about evaluation context
09-11-2024
12:54 AM
there is an example in Microsoft training modules 2-aggregation-iterator-functions . and in the higher grain summarization part, it gives a formula:
Revenue Avg Order =
AVERAGEX(
VALUES('Sales Order'[Sales Order]),
[Revenue]
)
where [Revenue] is:
Revenue =
SUMX(
Sales,
Sales[Order Quantity] * Sales[Unit Price] * (1 - Sales[Unit Price Discount Pct])
)
lets put them together:
Revenue Avg Order =
AVERAGEX(
VALUES('Sales Order'[Sales Order]),
SUMX(
Sales,
Sales[Order Quantity] * Sales[Unit Price] * (1 - Sales[Unit Price Discount Pct])
)
)
my question is:
is the formula above the same as this one? why?
(I test these two formulas and find them return the same result in my data model. )
Revenue Avg Order2 =
AVERAGEX (
VALUES('Sales Order'[Sales Order]),
SUMX (
FILTER(Sales, Sales[Sales Order] = EARLIER('Sales Order'[Sales Order])),
Sales[Order Quantity] * Sales[Unit Price] * (1 - Sales[Unit Price Discount Pct])
)
)
Solved! Go to Solution.
1 ACCEPTED SOLUTION
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2024
01:26 AM
chatgpt gives an answer as follows:
Execute SUMX
- For each Sales Order, AVERAGEX passes the current Sales Order as the row context and evaluates the SUMX function.
- SUMX(Sales, ...) iterates over the Sales table. However, because DAX applies the current row context automatically, the SUMX will only process rows in the Sales table that match the current Sales Order.
- This is due to DAX’s context propagation, where the outer row context (in this case, the current Sales Order) is passed into the inner calculation, so SUMX operates only on rows that match the Sales Order.
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2024
01:26 AM
chatgpt gives an answer as follows:
Execute SUMX
- For each Sales Order, AVERAGEX passes the current Sales Order as the row context and evaluates the SUMX function.
- SUMX(Sales, ...) iterates over the Sales table. However, because DAX applies the current row context automatically, the SUMX will only process rows in the Sales table that match the current Sales Order.
- This is due to DAX’s context propagation, where the outer row context (in this case, the current Sales Order) is passed into the inner calculation, so SUMX operates only on rows that match the Sales Order.

Helpful resources
Announcements
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - February 2025
Check out the February 2025 Power BI update to learn about new features.

Recommendations
Subject | Author | Posted | |
---|---|---|---|
02-06-2025 06:18 AM | |||
01-24-2024 10:40 AM | |||
02-10-2025 09:47 AM | |||
12-15-2021 08:08 AM | |||
Anonymous
| 01-17-2024 02:10 AM |
Top Solution Authors (Last Month)
User | Count |
---|---|
24 | |
13 | |
10 | |
10 | |
8 |
Top Kudoed Authors (Last Month)
User | Count |
---|---|
16 | |
15 | |
13 | |
12 | |
10 |