Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
awp2020
Contributor III
Contributor III

YTD

Hello,

I would like to calculate a year to date average . Below is an example of calculation that I would like to put in a graph without selecting period.

 

awp2020_0-1662639047209.png

awp2020_1-1662639292303.png

 

I put this formula for YTD average :

RangeAvg(above(Avg ({<PERIOD = {">=1/1/2019<=01/01/2025"}>} PROD),0,12) )

it works until 01/12/2019 but after that I have a rolling average over 12 months. How can I do to have a real ytd ?

 

Thank you for your help.

Labels (1)
1 Solution

Accepted Solutions
awp2020
Contributor III
Contributor III
Author

I answer myself, because I found!
Thanks for the help..

I added 2 new columns , I split PERIOD into YEAR and YEAR_MONTH. And I used the aggr function to group by by year and year_month.

aggr(RangeAvg( above( Avg ( PROD),0,12) ),YEAR,YEAR_MONTH)

 

 

View solution in original post

4 Replies
awp2020
Contributor III
Contributor III
Author

No ideas ?

awp2020
Contributor III
Contributor III
Author

Why does the calculation work with a table and with a graph the result is different?

I put the same formula

awp2020
Contributor III
Contributor III
Author

I just want to perform a rolling average over the year.

This formula : RangeAvg(above(Avg ({<PERIOD = {">=1/1/2019<=01/01/2025"}>} PROD),0,12) )

 
works for a table but for a curve.
 
Thank you for tour help !
awp2020
Contributor III
Contributor III
Author

I answer myself, because I found!
Thanks for the help..

I added 2 new columns , I split PERIOD into YEAR and YEAR_MONTH. And I used the aggr function to group by by year and year_month.

aggr(RangeAvg( above( Avg ( PROD),0,12) ),YEAR,YEAR_MONTH)