Forum Discussion
How to create Rolling Average with +/-St. Dev. Band
- Anonymous4 years ago
Hi wlf0032
Do you want to keep the visual in red box and show others in blank?
I think you can add a If function in your measure.
New = If (Date[Dates]>= MIN(Date[Dates])&&Date[Dates]<=MAX(Date[Dates]),[StockIndex_1YMA+sd],blank())Or you can try to create an unrelated date table to build the slicer. Then create New measure based on unrelated date table.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
wlf0032
I created a Power BI file using MSFT close value, please check if this fits your requirements. I didn't quite understand +1 and -1 here.
MA 365 =
CALCULATE(
AVERAGE(MSFT[Close]),
DATESINPERIOD( Dates[Date] , MAX(Dates[Date]) , -365 , DAY )
)
Std + 1 =
[MA 365] +
STDEVX.S(
DATESINPERIOD( Dates[Date] , MAX(Dates[Date]) , -365 , DAY ),
[Close Value]
)Std - 1 =
[MA 365] -
STDEVX.S(
DATESINPERIOD( Dates[Date] , MAX(Dates[Date]) , -365 , DAY ),
[Close Value]
)
Check the attachment below my signature
- wlf00324 years agoFrequent Visitor
Really appreciate your solution! I tried your way, but this seems doesn't solve my problem.
1. the std dev measure shouldn't be a moving measure. It should be static, i.e. std dev of all available data.
2. this won't help with the date slicer issue. when I filter the date slicer, this std dev still shows on the chart for those dates being filtered out.
Thanks anyway!