Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Aggr() function

Hi

Can anyone explain me how the Aggr() function works with beautiful example with data in different scenarios.

B'coz i'm getting confuse on this functionality. I've gone through the reference manual also..

53 Replies
Not applicable
Author

Thanks @John Witherspoon. Crystal clear explanation. My book Qlikview 11 for developers used a complex example to explain this concept. I am saved thanks to you.

Anonymous
Not applicable
Author

Albert Einstein said "If you can't explain it simply, you don't understand it well enough" John Witherspoon proved it. Super Example on AGGR. thanks John

Not applicable
Author

Hi John,

Can we display each bar wise 100% instead of all bars.Tot_percentage.png

sudhir0538
Creator
Creator

Very good simple explanation.

Thanks John

sujeetsingh
Master III
Master III

Best and simplest way to explain AGGR

kamal_sanguri
Specialist
Specialist

Hi,

Since it creates a temp table.. I know if I wrap AGGR inside CONCAT.. It will give me the value of expression.. but is there any way I can get the dimensions as well.. i.e Name of Customer in the example you have provided.

Thanks,

-Kamal

johnw
Champion III
Champion III

Probably something along these lines?

concat(aggr(Customer&' '&max(Value),Customer),', ')

That's probably what I'd write, but I consider it a bad habit. I feel like this is technically more correct:

concat(aggr(only(Customer)&' '&max(Value),Customer),', ')

QlikView syntax lets you get away with not using only() when aggregating, whether that's a table or an aggr(), and so I almost never use only(). I believe the above expressions should behave exactly the same, but the one with only() is being explicit about what it's doing, while the other, arguably, just happens to work because QlikView syntax is a bit loose. You wouldn't get away with doing this in SQL without an aggregation function, for instance.

kamal_sanguri
Specialist
Specialist

Thanks much johnw  for your response, appreciated your help even on closed thread.

Thanks Again,

-Kamal

dmitrydv
Contributor II
Contributor II

Thanks alot for your simple and full example of using the Aggr. Now it's clear for me.

Best regards,

Dmitry

acardella
Partner - Creator
Partner - Creator

You can try to use a Group (Year,H,Month....) and then, in expression, you can use
$(=GetCurrentField([####GROUPNAME####]))