i’m willing to compute moving average for the price over the past 7 days. Here is my code but it’s not working yet:

[date ASC],

hello what is the error you are getting ?
windowAvg(sum({close_price}), [date ASC], 7,0, [crypto_name])

What i wanna do is compute the average for the price of cryptomoney over the past 7 days ad i probably use the documentation the wrong way. How would you do that?

in my databqse, close price is given for every crypto, everyday
i’m using date for the date and

close_price for the price (one data a day)

so this one works for you ?


windowAvg(sum({close_price}), [date ASC], 7,0, [crypto_name])


The windowAvg function calculates the average of the aggregated measure this from the aws docs you need to have an aggregated measure there windowAvg - Amazon QuickSight

NO it is not working yet

the closest i can get is this but it computes price average from the beginning of the week: i want 7 days, not from monday
periodToDateAvg({close_price}, date, WEEK, now())

Hello, not sure if this was resolved if it was not my understanding was you were calculating a moving avg so not sure why you tried periodtodate with WEEK and now() .
what was the error you were getting with the below?

windowAvg(sum({close_price}), [date ASC], 7,0, [crypto_name])

Also would be good to have a sample data even in excel with your expected result to be able to help otherwise it gets difficult this way

Dear, I’m using the SQL queries instead and it’s working (better).
Have a nice day!