Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
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

 

='('  &  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

garbage errorgarb.PNG

pradosh_thakur
Master II
Master II

My bad 

 

='('  &  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

No luck 😞 still its taking only 2018Q4

assume that i have data 2018Q1 ,2018Q2,2018Q3,2018Q4 ......... the result 2018Q3,2018Q4

pradosh_thakur
Master II
Master II

What about this 

=chr(39) & '('  &  year(today()) & 'Q' & ceil(month(today())/3) & '|' &  year(ADDMONTHS(today(),-3)) & 'Q' & ceil(month(ADDMONTHS(today(),-3))/3)   &   ')' & chr(39)
Learning never stops.
soniasweety
Master
Master
Author

Nothing selecting in listbox 😞
pradosh_thakur
Master II
Master II


@soniasweety wrote:
No luck 😞 still its taking only 2018Q4

assume that i have data 2018Q1 ,2018Q2,2018Q3,2018Q4 ......... the result 2018Q3,2018Q4


Hey ,,, you said latest quarter so it should select 2018q4 AND 2019 Q1 

 

If you need max quarter  and second max quarter you have to use maximum expression i have asked you to use 

Learning never stops.
soniasweety
Master
Master
Author

anything.. dynamically it should take max two quarters whatever the quarters present in the data.

i cant use for 2018Quarters seperatly and 2019Qurters seperately 😞
pradosh_thakur
Master II
Master II

See.. there are two cases 

maximum and second maximum quarter use

'('  & MaxString({<string=-{"$(=maxstring(string))"}>}string) & '|' &  maxstring(string)    &   ')'

latest and second latest quarter 

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

 

 

edit: replace string with your quarter field in first expression 

Learning never stops.
pradosh_thakur
Master II
Master II

Hi

 

Did you solve this . if yes then please close the thread.

If not then i am attaching the sample QVW as you have asked, I didn't have qv with me when you asked for a sample. Attached sample is using the expression i have asked you to use.

 

Thanks

Pradosh

Learning never stops.