
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
First sorted Value from Non numeric field
Hi Everyone,
I am stuck with one of the formula in QlikSense. I have non numeric field "SCENARIO" in my app. I need to sort this field in descending order and get first value and use this in formula.
Also, other filters which we use in Set analysis for formula should also be considered while getting the SCENARIO field to sort.
I used below expression , but it does not give me any values :
=FirstSortedValue(SCENARIO,-SCENARIO)
I need some expert advise on this.
Thank you in advance.
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Or, a simpler solution could be using maxtring()/minstring(), like:
=MaxString(SCENARIO)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You need to put the set analysis component in the variable expression as well like:
I created variable v_max_TK_IND227, which has Max(time_key) values
=Max({<time_key>} time_key)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@ArchanaB try below expression
=FirstSortedValue(SCENARIO,aggr(rank(SCENARIO),SCENARIO))

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Or, a simpler solution could be using maxtring()/minstring(), like:
=MaxString(SCENARIO)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thank you . It works.
I also need to display MAxString(Scenario) for Max(time_key) , I created variable v_max_TK_IND227, which has Max(time_key) values . If user select another time_key then I need to ignore the selection and the MaxString(Scenario) should display the same value through out.
I am using below expression but it is not ignoring Time_key filter.When I select another time_key, the value of MAxString(Scenario) is affecting. Please suggest.
=MaxString({<TIME_KEY=, DATA_TYPE={'AOP_FTE'},VERSION ={'Final Version'},TIME_KEY = {"$(=($(v_max_TK_IND227)))"}>}SCENARIO)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You need to put the set analysis component in the variable expression as well like:
I created variable v_max_TK_IND227, which has Max(time_key) values
=Max({<time_key>} time_key)
