Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
samuel_brierley
Creator
Creator

first sorted value and aggr

hi all,

i cant seem to work out why the below wont work

=FirstSortedValue(aggr(sum({$< Area -= {''}>}[Total Emissions]),Area),Area)

basically the aggr creates a virtual table of total emissions grouped by area (this works ive tested it separately). i then want to sort that table such that i return the area with the highest total NOx.

any help is much apprecoated/

thanks

1 Solution

Accepted Solutions
sunny_talwar

Try this

=FirstSortedValue({$< Area -= {''}>} Area,-Aggr(Sum({$< Area -= {''}>}[Total Emissions]),Area))

Capture.PNG

View solution in original post

10 Replies
rahulpawarb
Specialist III
Specialist III

Could you please share sample application? this will help us to provide expected inputs.

Regards!

Rahul Pawar

balar025
Creator III
Creator III

Any Sample data or app?

antoniotiman
Master III
Master III

Hi Sam,

maybe this

FirstSortedValue(DISTINCT Area,-Aggr(Sum([Total Emissions]),Area))

or provide sample data.

Regards,

Antonio

Anil_Babu_Samineni

I think you missed first parameter

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
sunny_talwar

Try this

=FirstSortedValue({$<Area -= {''}>} Area, -Aggr(Only({$<Area -= {''}>} Area), Area))

samuel_brierley
Creator
Creator
Author

Hi all,

thanks for the suggestions but they dont seem to be working quite yet.

i've attached a sample for your reference.

sunny_talwar

Try this

=FirstSortedValue({$< Area -= {''}>} Area,-Aggr(Sum({$< Area -= {''}>}[Total Emissions]),Area))

Capture.PNG

samuel_brierley
Creator
Creator
Author

excellent thank you!!!

sasiparupudi1
Master III
Master III

Swap the aggr and area dimensions

FirstSortedValue(Distinct Area,-aggr(sum({$< Area -= {''}>}[Total Emissions]),Area))