Qlik Community

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Customer & Partners, DEC. 9, 11 AM ET: Qlik Product & Strategy Roadmap Session: Data Analytics REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
jgreen95
Contributor III
Contributor III

Second sort variable with First sorted value function

I am listing regions by number of failures and occasionally 2 have the same number of failures, is there a way to add a second sort varibale e.g. alphabetical? as i want to show both on my list and currently it is just showing null.

Labels (2)
5 Replies
Digvijay_Singh

May be try distinct in the first sorted value.

tresesco
MVP
MVP

You can. But that depends on your data. Or, you can use concat() additionally to keep multiple categories like:

=FirstSortedValue(Aggr(Concat(DISTINCT Region, ','), Failure), -Aggr(Failure,Failure))

Capture.PNG 

jgreen95
Contributor III
Contributor III
Author

My current formula is:

=FirstSortedValue(Authority, -Aggr((COUNT(DISTINCT{<[Inspection Outome]={"Failed (Higher Risk/Dangerous)"},
[Inspection Logged-Notification Created Date.MyCalendar1.WeekEnd] = {">$(=[Current Week])"}>} INSPECTION_NOTICE_ID )), Authority),5)

 How would i add a second sort variable to this?

jgreen95
Contributor III
Contributor III
Author

Id prefer not to concat if possible, how would i add an alphabetical sort as the second sort variable?

tresesco
MVP
MVP

Could you share a sample and explain your exact (how and where) expected output?

 

Note: For second alphabetical sort you could rank(), like:

=FirstSortedValue(Region, -Failure- Aggr(Rank(Region), Failure,Region))