Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
soniasweety
Master
Master

Default

Hi all

Gysbert Wassenaar

i have field   quarter

2017Q1

2017Q2

2017Q3

2017Q4

2018Q1

2018Q2

2018Q3

so i want to be default selection with  last four  quarters when ever i open the dashboard.

1 Solution

Accepted Solutions
tresesco
MVP
MVP

I guess, simple rank() could work here.

Search String ='=Rank(Quarter)<5'

Capture.JPG

try the same search string in OnOpen trigger.

View solution in original post

8 Replies
Anil_Babu_Samineni

Do you have date field? If so, I suggest you to work from Date field like for OnOpen Trigger using DateField is the field and String like below.

='>=' & Date(QuarterStart(Max(DateField), -4)) & '<=' & Date(Max(DateField))

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
soniasweety
Master
Master
Author

i dont have date field anil.  from database directly getting that  field.

marcus_sommer

I assume that your Quarter is a string what meant that there is no easy way to calculate with the values but you could create a date from it, for example with something like: date(date#('2017Q1', 'YYYYQM'))

But easier in your case should be to load your data sorted to Quarter and using:

autonumber(Quarter) as QNumber

and then your condition within the trigger could look like

= '>=' & max(QNumber) - 4

- Marcus

soniasweety
Master
Master
Author

its not working

marcus_sommer

i have created   autonumber(Quarter) as QNumber

and in onopen trigger

field= QNumber

string=

= '>=' & max(QNumber) - 4

but its not giving the result.

soniasweety
Master
Master
Author

hI

ATTACHING THE SAMPLE

tresesco
MVP
MVP

I guess, simple rank() could work here.

Search String ='=Rank(Quarter)<5'

Capture.JPG

try the same search string in OnOpen trigger.

marcus_sommer

Does it select the wrong quarters or happens nothing? The autonumber-approach worked only if the data are loaded with a proper sorting. Further worked with only one parameter if it's used once - by applying it multiple times a second parameter must be specified.

Whereby I think the solution from Tresesco is even more easier.

- Marcus

soniasweety
Master
Master
Author

yes   tresesco solution is working perfect.

but one doubt i have here     i have given background color  for dimension but it is not taking all values  why this is happening?dim-clr.PNG