Forum Discussion
ChiragPatnaik
2 years agoRegular Visitor
Comparing with a rolling average.
I am looking to create a rolling average of volume for each symbol. and then set a flag if today's/(the day's) volume for the symbol is higher than this average. This is what I have right now. ...
- 2 years ago
Hi ChiragPatnaik - Not sure , why my solution is disappeared for this question, again posting on the same thread. please check the below measure for rolling ag. and flag.
RollingAvgVolume =
CALCULATE(
AVERAGE(Delivery[TTL_TRD_QNTY]),
FILTER(
ALL(Delivery),
Delivery[SYMBOL] = MAX(Delivery[SYMBOL]) &&
Delivery[DATE1] <= MAX(Delivery[DATE1]) &&
Delivery[DATE1] > MAX(Delivery[DATE1]) - 35
)
)create a flag measure as below:
VolumeFlag =
IF(
MAX(Delivery[TTL_TRD_QNTY]) > [RollingAvgVolume],
"Up",
"Down"
)Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!
jdbuchanan71
2 years agoSuper User
To get it to move by day you just need to adjust it a bit. Sorry, I was thinking you wanted the current 35 days always.
Rolling Average =
VAR _MaxDate = MAX ( Delivery[DATE1] )
VAR _Start = _MaxDate - 35
RETURN
CALCULATE (
AVERAGE ( Delivery[TTL_TRD_QNTY] ),
DATESBETWEEN ( Delivery[DATE1], _Start, _MaxDate )
)