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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Using result of an Expression in Aggregate function

Hello All,

I am trying to use result of one of my expression in an aggregate function. But it says "bad field name". I know we cannot use them inside aggregate function. Is there any alternative to do this? Below is an Example.

Exp1: date(salesdate) - Label- Startdate

Exp2: Sum(if(salesdate>=Startdate and salesdate<=addmonths(Startdate,6),SalesQuantity,0))

1 Reply
swuehl
MVP
MVP

In this specific case, date(salesdate) is just formatting the salesdate value to a date format.

In Exp2, you don't need a formatted date to make your numeric comparisons, so you could just write

=Sum(If(salesdate >= salesdate and salesdate <= addmonths(salesdate,6), SalesQuantity,0))

But the date comparisions are always true, right?

So I guess that's not what you want (but it has nothing to do with expression referencing then, too).