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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out 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

Labels (1)
13 Replies
ilanbaruch
Specialist
Specialist
Author

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

sunny_talwar
MVP
MVP

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
MVP
MVP

Awesome