Announcements
[WEBINAR] Accenture & Qlik: Accelerating BI Migration to SaaS with Qlik on Dec 13th: REGISTER
cancel
Showing results for
Did you mean:
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
MVP

Try this

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

10 Replies
Specialist III

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

Regards!

Rahul Pawar

Creator III

Any Sample data or app?

Master III

Hi Sam,

maybe this

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

or provide sample data.

Regards,

Antonio

I think you missed first parameter

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
MVP

Try this

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

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.

MVP

Try this

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

Creator
Author

excellent thank you!!!

Master III

Swap the aggr and area dimensions

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

Community Browser