Forum Discussion
jbradley16
8 years agoFrequent Visitor
Weighted Average Held By Constant Weight
Hello all, I'm attempting to compare two values of Weighted Average Price over a pre and post date set. The formulas I currenlty have are setup like: Post Period Weighted Avg: sumx(table, quantit...
Anonymous
8 years agoNot applicable
HI jbradley16,
I can't understand your formula, can you please explain more about these with some sample data and expected result?
If you mean nested measures, you can try to use below formula if it suitable for your requirement:
Pre Period Weighted Avg =
VAR temp =
SUMX ( ALLSELECTED ( table ), [quantity] * [price] )
/ SUM ( table[quantity] )
RETURN
CALCULATE (
temp,
ALL ( postdatetable ),
USERELATIONSHIP ( table[date], predatetable[date] )
)
Constant WAP =
VAR temp =
CALCULATE (
SUM ( table[quantity] ),
ALL ( postdatetable ),
USERELATIONSHIP ( table[date], predatetable[date] )
)
RETURN
SUMX ( ALLSELECTED ( table ), [Pre Period Weighted Avg] * temp )
/ temp
Regards,
Xiaoxin Sheng