Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sum of difference of dates

Hi everyone ,

Can you point out error in the below expression???

Sum(

(Date(sale_date,'MM/DD/YYYY')-Date(Min( Total<category> sale_date),'MM/DD/YYYY'))

)

Thanks.

2 Replies
Gysbert_Wassenaar

You're using min inside a sum without an aggr. If you nest aggregation functions you need to use the aggr function

Sum(

(Date(sale_date,'MM/DD/YYYY')-Date( aggr( Min( Total<category> sale_date), SomeDimensionHere ) ,'MM/DD/YYYY'))

)

Perhaps SomeDimensionHere is category in your case.


talk is cheap, supply exceeds demand
swuehl
MVP
MVP

You are using an aggregation function (min() ) within another aggregation function (sum() ), which is not possible.

You probably need to apply advanced aggregation (i.e., the aggr() function).