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

Reference to outer aggr current “cursor” position from an inner aggr or set analysis expression

Assuming we have a set of numbered weeks (for example, 1-100).

I want to create a minichart where for the last 8 weeks I am showing 4-weeks avg.

This would work, if the weeks were preordered (could somebody hint how this could be enforced?):

aggr(sum({<weekno= {'<=$(=vCurrWeekNo)>$(=vCurrWeekNo - 8)'}> }

aggr(rangesum (above(sum(amt),0,4)), dim1, weekno)

), dim1, weekno)

Alternative would be using something similar to CurrentWeekNo() (could not figure out how to use top()/above(), etc for this):

aggr(sum({<weekno= {'<=$(=vCurrWeekNo)>$(=vCurrWeekNo - 8)'}> }

aggr(sum({<weekno= {'<=$(=CurrentWeekNo())>$(=CurrentWeekNo() - 4)'}> } amt)

), dim1, weekno)

I am missing something basic… would appreciate the help.

0 Replies