Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
ArchanaB
Contributor III
Contributor III

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.

 

 

 

 

2 Solutions

Accepted Solutions
tresesco
MVP
MVP

Or, a simpler solution could be using maxtring()/minstring(), like: 

=MaxString(SCENARIO)

View solution in original post

tresesco
MVP
MVP

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)
 

View solution in original post

4 Replies
Kushal_Chawda

@ArchanaB  try below expression

=FirstSortedValue(SCENARIO,aggr(rank(SCENARIO),SCENARIO))

tresesco
MVP
MVP

Or, a simpler solution could be using maxtring()/minstring(), like: 

=MaxString(SCENARIO)

ArchanaB
Contributor III
Contributor III
Author

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)

 

tresesco
MVP
MVP

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)