Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Mastering Change Data Capture: Read Now
cancel
Showing results for 
Search instead for 
Did you mean: 
inescastelhano
Partner - Creator II
Partner - Creator II

sum if / sum aggr

Hi everyone,

I have the following expressions, both work fine separately. Now I need to subtract them, and have the equivalent to "sum of rows" that one can have in straight table. I think I should use aggregate, but it returns null when I use it. Could someone help me please?

Expression 1:

(min({<myYear=,myMonth=,myDay=,myDate=,[Date 1]={'<$(=date(min(myDate)))'},[Date 2]={'>=$(=date(min(myDate)))<=$(=date(max(myDate)))'}>}[Date 2])

(could also be achieved with max, sum or only)

Expression 2:

-(min(total{$}

([Data])))

Final expression:

sum(aggr(Expression 1 - Expression 2 , ID))

This final expression returns null.

Thanks in advance.

Inês

11 Replies
sunny_talwar

This expression seems to be working:

=Sum({<myYear=,myMonth=,myDay=,myDate= >} Aggr(Min({<myYear=,myMonth=,myDay=,myDate=,[Date 1]={'<$(=date(min(myDate)))'},[Date 2]={'>=$(=date(min(myDate)))<=$(=date(max(myDate)))'}>}[Date 2])-Min(TOTAL [myDate]), [Nº de Episódio]))

inescastelhano
Partner - Creator II
Partner - Creator II
Author

Oh my God.

I have been working on this for days... And now it works!! Thank you so much!

All the best,

Inês