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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Help with aggr function

=aggr(only({<MasterDate = {'$(=date(max(MasterDate)))'},Value = {'$(=max(Value))'}, Name -= {'Team*'}>}Name),Name)

In my app, there are two types of names, team names (begin with 'Team') and individual names (normal names). I'm trying to retrieve the Team with the top 'value' from the most recent date and the Individual with the top 'value' from the most recent date.

This function works fine without the:

Name -= {'Team*'}

But I need to find a way to separate individuals from teams.

4 Replies
sasikanth
Master
Master

Try some thing like below

=aggr(only({<MasterDate = {'$(=date(max(MasterDate)))'},Value = {'$(=max(Value))'}, Name ={'*'}- {'Team*'}>}Name),Name)

Not applicable
Author

No dice, thanks for the suggestion though.

Not applicable
Author

Nevermind. I figured it out.

jerem1234
Specialist II
Specialist II

I think you'll need to add the set analysis to your max value as well. Since you are reducing the Names you want the max value for. For example, the max value (80) is for Team B. But when you want the individuals, you exclude Team B with the set analysis. But the max(Value) will still return the max value (80), but this doesn't match any individual.   So try:

=aggr(only({<MasterDate = {'$(=date(max(MasterDate)))'},Value = {'$(=max({<Name -= {'Team*'}>}Value))'}, Name -= {'Team*'}>}Name),Name)


You could also try using firstsortedvalue or rank functions


Hope this helps!