cancel
Showing results for
Did you mean:
Post Patron

## STDEV.s for last 90 days - calculated column

Hi Experts

How could you calculate the STDEV,S for the last 90 days as a calculated column in power bi

Excel formula - =STDEV.S(AW4:AW93)*SQRT(252)

1 ACCEPTED SOLUTION
Solution Sage
``````FAME0 90-Day Volatility 2 =
var current_day = BioDiesels[Date]
return
STDEVX.S(
FILTER(
ALL(BioDiesels),
BioDiesels[Date] in DATESINPERIOD(DimDate[Date], current_day, -90, DAY)
),
BioDiesels[FAME0 Price Interday]
)``````
6 REPLIES 6
Solution Sage
Post Patron

Hi bolfri. That does not work I tried it. Unless you can roof me wrong?

Solution Sage

Boyfriend? 😂

Can you share sample data or something? Nameing of your calendar table? Then I can help with DAX. It's all about running -90 days on calendar to the current date on your table.

Post Patron

Boyfriend? - Auto correct. LOL

1. i satrted the calculation (calculated column measure)

FAME0 90-Day Volatility = STDEV.S(BioDiesels[FAME0 Price Interday])*SQRT(252) - wrong

2. i need it for last 90 days based on column..FAME0 Price Interday

Sample Data

I found this on line - this might work but not sure on how to amend the DAX

thanks
Solution Sage
``````FAME0 90-Day Volatility 2 =
var current_day = BioDiesels[Date]
return
STDEVX.S(
FILTER(
ALL(BioDiesels),
BioDiesels[Date] in DATESINPERIOD(DimDate[Date], current_day, -90, DAY)
),
BioDiesels[FAME0 Price Interday]
)``````
Post Patron

Hi thanks for the feedback butthe expexted end result did not agree with excel

Announcements

#### Power BI Community Changes

Check out the changes to the Power BI Community announced at Build.

#### Power BI May 2023 Update

Find out more about the May 2023 update.