Forum Discussion
Sudharsanan
4 years agoHelper III
Weighted Avg calculation
Hi friends, I need help in calculating weighted avg for the below data using DAX. can someone help me? Logic: (Sum of CY sales)/((sum of PY sales)/(sum of PY qty))*sum of Cyqty)))-1 C...
- 4 years ago
Sudharsanan , Assuming all are columns
Divide(Sum(Table[CY sales]), Sumx(Table, Divide([PY sales],[PY qty]) * Table[Cyqty]) ) -1
Fowmy
4 years agoSuper User
Sudharsanan
It depends where your year column is, if it is in the same table then
W AVG =
DIVIDE(
SUM(Table2[CySale]),
SUMX(
FILTER ( TABLE2 ,TABLE2[Year] = 2022 ) ,
DIVIDE( Table2[PYSale] , Table2[PY Qty] ) * Table2[CyQty]
)
)-1Sudharsanan
4 years agoHelper III
Hi Fowmy
i am able to get the correct result for individual product but the overall value is still not coming up correctly.