Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Last year sales averaged by issue date

Hi All,

I would really appreciated if someone could help with this function as it doesn't work at all.

avg(aggr(sum(SUPPLY_QUANTITY),ISSUE_DATE)) and this gives me the sales for the selected year as a monthly average

now I would like to have the same data for previous year based on the selected year.

avg(aggr(sum(if(Cal_Year=vLY,SUPPLY_QUANTITY)),ISSUE_DATE))

Cal_Year is a field

vLY is a variable which is =Cal_Year-1

but for some reasons it doesn't work although it's set to last year?

if this helps I've attached picture of how the data is presented.

Picture1.png

1 Solution

Accepted Solutions
CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     How you Created the Year filter?is it Cal_Year?

     if so try this

    

avg({$<Cal_Year = {$(vLY)}>} aggr(sum( {$<Cal_Year = {$(vLY)}>} SUPPLY_QUANTITY ),ISSUE_DATE))

Celambarasan

View solution in original post

4 Replies
jvitantonio
Luminary Alumni
Luminary Alumni

Try this:

avg(aggr(sum( {$<Cal_Year = {$(#vLY)}>} SUPPLY_QUANTITY ),ISSUE_DATE))

Not applicable
Author

Hi,

Thanks for your help but unfortunately it's still showing no data, it works with summing but not with adding avg(aggr.

Regards,

Redha

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     How you Created the Year filter?is it Cal_Year?

     if so try this

    

avg({$<Cal_Year = {$(vLY)}>} aggr(sum( {$<Cal_Year = {$(vLY)}>} SUPPLY_QUANTITY ),ISSUE_DATE))

Celambarasan

Not applicable
Author

Hi Calambarasan,

Thank you so much you've saved my life as it's been a while trying to figure this out.

Thanks again

Regards,

Redha