Skip to main content
Announcements
Qlik Community Office Hours - Bring your Ideation questions- May 15th, 11 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

new to aggregate functions

I'm trying to figure out how to have a function return the number of times the total pallets for a given date are greater than or equal to 6.  I've pasted an example of my data below.  Basically, I need it to first sum the number of pallets on each given date and then tell me how many times that total is greater than or equal to 6...in this case, the result should be 2.  I think an aggregate function is how I get there but I am extremely new to this and can't seem to get it to work.  Help!

 

ship date# of pallets
1/1/20162
1/1/20163
1/1/20161
1/1/20167
1/2/20162
1/2/20166
1/3/20161
1/3/20161
1/3/20161
1/4/20163
3 Replies
sunny_talwar

May be like this in a text box object

Sum(Aggr(If(Sum([# of pallets]) >= 6, 1, 0), [ship date]))

Not applicable
Author

It worked perfectly.  Thank you! 

Now to take it a step further...let's say I want it to return the number of times the sum is between 4 and 7.  How would I write that?

sunny_talwar

May be like this:

Sum(Aggr(If(Sum([# of pallets]) >=4 and Sum([# of pallets]) <= 7, 1, 0), [ship date]))

Or this should also work:

Count(DISTINCT {<[ship date] = {"=Sum([# of pallets]) >=4 and Sum([# of pallets]) <= 7"}>} [ship date])

and Similarily the expression provided previously can also be replaced by this:

Count(DISTINCT {<[ship date] = {"=Sum([# of pallets]) >=6"}>} [ship date])