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: 
ilanbaruch
Specialist
Specialist

aggr with variables

hi all,

is it possible to aggregate from a variable?

tried it like this

=FirstSortedValue(PAYMENT_TYPE, -Aggr($(Amount$), PAYMENT_TYPE))

but didn't retrieve..

any ideas?

advanced thanks

13 Replies
ilanbaruch
Specialist
Specialist
Author

retrieve PAYMENT_TYPE (Name)  by the maximum amount (amount)

sunny_talwar

Then this should work unless you have duplicates

=FirstSortedValue(PAYMENT_TYPE, -Aggr(Sum(AMOUNT), PAYMENT_TYPE))

or you can do this if you have duplicates and you want to pick one name

=FirstSortedValue(DISTINCT PAYMENT_TYPE, -Aggr(Sum(AMOUNT), PAYMENT_TYPE))

or this if you wish to show all PAYMENT_TYPE separated by commas

=Concat(DISTINCT {<PAYMENT_TYPE = {"=Rank(Sum(AMOUNT)) < 2"}>} PAYMENT_TYPE)

ilanbaruch
Specialist
Specialist
Author

!!!duplicates !!!

this was the issue


thank you very much!

sunny_talwar

Awesome