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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
john_henry
Contributor III
Contributor III

FirstSortedValue and set analysis

I am trying to display the region with the max value, but filtered by a specific type.  I have the following formula which finds the highest region based on count of IDs.

FirstSortedValue(DISTINCT Region,-Aggr(count(ID),Region))

Now I need to limit the above formula to evaluate where "Type" column is only "Robo".  I tried using set analysis, but was unsuccessful:

=FirstSortedValue(DISTINCT Region,-Aggr(count({<Type={'Robo'}>}ID),PROVINCIA))  

How do I find the Region with the highest count of IDs where Type is only 'Robo'?

Labels (2)
1 Reply
Anil_Babu_Samineni
MVP
MVP

Your formula should work, Is that not working for you?

=FirstSortedValue(DISTINCT Region,-Aggr(count({<Type={'Robo'}>}ID),PROVINCIA))  

If it is not working, Perhaps restrict at end of dimension as well

=FirstSortedValue({<Type={'Robo'}>} DISTINCT Region,-Aggr(count({<Type={'Robo'}>}ID),PROVINCIA))  

Or

=FirstSortedValue({<Type={'Robo'}>} DISTINCT Region,-Aggr(NODISTINCT count({<Type={'Robo'}>}ID),PROVINCIA))  

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