Forum Discussion
Issue with Aggregating Measures Using SELECTEDVALUE()
Hi VT_KMS , Thank you for reaching out to the Microsoft Community Forum.
We have two methods to do this:
By using CALCULATE, you modify the filter context to ignore the product-level details while keeping the month-level context intact. SUMX then iterates over all products and sums the revenue changes correctly. This is the most efficient and robust solution, especially for larger datasets.
sum_updownsell_product =
CALCULATE(
SUMX(
ALL(ARRDATA_CUSTOMER_PRODUCT), -- Removes product-level filters
[revenue_change_product]
),
VALUES(ARRDATA_CUSTOMER_PRODUCT[MONTH]) -- Keeps the month-level filter
)
The second approach uses SUMMARIZE to create a temporary table grouped by month, then uses SUMX to iterate over it and aggregate the revenue changes. While this works perfectly fine, it may be less performant on large datasets due to the table creation step.
sum_updownsell_product =
SUMX(
SUMMARIZE(
ARRDATA_CUSTOMER_PRODUCT,
ARRDATA_CUSTOMER_PRODUCT[MONTH],
"MonthlyRevenueChange", SUM([revenue_change_product])
),
[MonthlyRevenueChange]
)
If this helped solve the issue, please consider marking it 'Accept as Solution' so others with similar queries may find it more easily. If not, please share the details, always happy to help.
Thank you.