cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
BlueWhite111
Post Patron
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)

 

 

BlueWhite111_0-1679609628790.png

 

1 ACCEPTED SOLUTION

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]
    )

View solution in original post

6 REPLIES 6
bolfri
Solution Sage
Solution Sage

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

 

 

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.

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
Link: 

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]
    )

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

See excel 
https://www.dropbox.com/scl/fi/0jo9doga8xgdikvw46ajs/Excel-End-Result.xlsx?dl=0&rlkey=qnsm5luhd3juyu... 

Helpful resources

Announcements
Exciting changes

Power BI Community Changes

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

May 2023 update

Power BI May 2023 Update

Find out more about the May 2023 update.

Kudo Data Story carousel

Data Stories Gallery

Visit our Data Stories Gallery and give kudos to your favorite Data Stories.

Top Solution Authors