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

aggr in set analysis modifier

Hi there,

I'm sure this is a quick one but I cant seem to figure it out.....

I am loading in the below test script

dates:
load * Inline [
date, pubd, sales
01/01/2017, 01/01/2016,1
01/01/2017, 01/02/2015,1
01/01/2017, 01/02/2014,1
01/01/2018, 01/01/2017,1
01/01/2018, 01/02/2016,1
01/01/2018, 01/02/2015,1
];

dates_final:
NoConcatenate Load
date(date) as date,
num(date(date)) as datenum,
num(date(date)) as pubend,
num(date(date))-730 as pubstart,
date(pubd) as pubd,
num(date(pubd)) as pubdnum,
sales
Resident dates;
drop table dates;

I am then using

=Sum({<pubdnum={">=$(=addmonths(Min(datenum),-24)) <=$(=Max(datenum))"}>}  sales)

but would like ={">=$(=addmonths(Min(datenum),-24)) <=$(=Max(datenum))"}>}  set modifier to be aggregated over datenum dimension, so I return 4 records and not 6.

={">=$(=addmonths(Min(datenum),-24)) <=$(=Max(datenum))"}>} is currently across the whole set and so returning 6 records.

Please see test application and screen-print attached.

Thanks in advance!

!

1 Solution

Accepted Solutions
sunny_talwar

May be this

=Sum(Aggr(If(pubdnum >= addmonths(Min(TOTAL <date> datenum),-24) and pubdnum <= Max(TOTAL <date> datenum), sales), pubdnum, date))

Capture.PNG

View solution in original post

3 Replies
PrashantSangle

not getting your requirement.

Try with below set expression.

=Sum({<pubdnum={">=$(=num(addmonths(Min(datenum),-24))) <=$(=Max(datenum))"}>}  sales)


Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
sunny_talwar

May be this

=Sum(Aggr(If(pubdnum >= addmonths(Min(TOTAL <date> datenum),-24) and pubdnum <= Max(TOTAL <date> datenum), sales), pubdnum, date))

Capture.PNG

Anonymous
Not applicable
Author

AWESOME, this worked Sunny, thanks!!!!!