Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
soniasweety
Master
Master

get two always

Hi all,

 

 @sunny_talwar

i have a field like  quarter  with values  like  2018Q1,2018Q2,2018Q3,2018Q4,2019Q1

so whenever i open the dashboard i need to see latest two quarters as selected.

how to achive this?

output: 2018Q4,2019Q1  [   if 2019Q2 in the data  the result will be  2019Q1 and 2019Q2]  like dynamic latest two quarters

 

Thanks

Labels (1)
20 Replies
pradosh_thakur
Master II
Master II

documrnt settings -> trigers-> on open -> select in field ->

 

lets assume string is the field.

=MaxString({<string=-{"$(=maxstring(string))"}>}string)    // this will give the second max string

=maxstring(string)    / this will give the max string

Learning never stops.
soniasweety
Master
Master
Author

giving error in expression.
soniasweety
Master
Master
Author

atatching sample

pradosh_thakur
Master II
Master II


@soniasweety wrote:
giving error in expression.

Well if your Quarters are string values this should work just fine. Did you change the field string to your quarter field? Can you please write your final expression here. I dont have the qlik license so would not be able to open it.

Learning never stops.
soniasweety
Master
Master
Author

your expression is taking the second higest quarter 😞 but i dont want that

i want latest two quarters that means 2018Q4 and 2019Q1 these are the latest two quarters to be selected in listbox by on open
pradosh_thakur
Master II
Master II

Isn't 2018Q4 the second highest quarter?  do you have future quarter listed as well?

Learning never stops.
soniasweety
Master
Master
Author

yes.

currently  2019Q1 is the max quarter  2018Q4 is the second max quarter.

 

so latest two quarters 2019Q1 and 2018Q4 to be selected.

pradosh_thakur
Master II
Master II

 

=MaxString({<string=-{"$(=maxstring(string))"}>}string)    // this will give the second max string

=maxstring(string)    / this will give the max string

the above will do if you want the max and second max quarter

 

for latest and second latest you can try

=year(today()) & 'Q' & ceil(month(today())/3)

=year(ADDMONTHS(today(),-3)) & 'Q' & ceil(month(ADDMONTHS(today(),-3))/3)

Learning never stops.
soniasweety
Master
Master
Author

thank you. but still its not working.

i need an single expression two select latest two quarters from the data
my data looks like below
Quarter
2018Q1
2018Q2
2018Q3
2018Q4 so now when i open the qlikview in listbox 2018Q3,2018Q4 should be selected.
for example 2019Q1 is added now the result should be 2018Q4 and 2019Q1
could you please attach your sample that you have tried?