I have a table with the following rows:
and I am trying to do a weighted average by Product and ReceiptYearMonth of CaseQuantity
I have created the following DAX measure to try to create the weighted average:
SumX Test = sumx(Query1,
Query1[CaseQuantity] /
calculate(
sum(Query1[CaseQuantity]), ALL(Query1[RecadvLineId])
)
)
but that just returns the following:
i.e. the measure returns 4.00 for 201702 because there are 4 rows in the table for 201702. It returns 2.00 for 201703 because there are 2 rows for it. At this stage I think they should be returning 1.00 for each YearMonth.
Can anyone explain what I am doing wrong here ?