Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

FirstSortedValue to find the last value.

I am using this expression to identify "the name of the State" that has "Maximum Contstituency":

=FirstSortedValue(State,(aggr(rank(count([Constituency-code])),[State-code])))

Now, when I want the reverse to find the name of the state that has "minimum Constituency", I use '-ve' sign:

=FirstSortedValue(State,-(aggr(rank(count([Constituency-code])),[State-code])))

It does not return any value. I am not sure where I am doing wrong with FirstSortedValue?

5 Replies
Anonymous
Not applicable
Author

Hi, you can try with =FirstSortedValue(State,(aggr(rank(-count([Constituency-code])),[State-code])))

Not applicable
Author

Hi,

I implemented what you mentioned but it too did not return any value.

Anonymous
Not applicable
Author

This?

=FirstSortedValue(State,(aggr(rank(count([Constituency-code])),[State-code])), count(distinct State))

vishsaggi
Champion III
Champion III

Try ?

= FirstSortedValue(State, -Aggr(only(Count([Constituency-code])),[State-code], State))

sunny_talwar

Are there more than one state where the Count([Constituency-code]) is the same? If that's true which State do you want? Randomly any or Concatenate the States to show all?


For Randomly one, you can try this:


- gives Max and +gives min


MaxCount

=FirstSortedValue(DISTINCT State, -Aggr(Count([Constituency-code]), [State-code], State))


MinCount

=FirstSortedValue(DISTINCT State, Aggr(Count([Constituency-code]), [State-code], State))