Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

soniasweety
Contributor III

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.

Tags (1)
1 Solution

Accepted Solutions
MVP
MVP

Re: Default

I guess, simple rank() could work here.

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

Capture.JPG

try the same search string in OnOpen trigger.

8 Replies

Re: Default

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))

soniasweety
Contributor III

Re: Default

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

Re: Default

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
Contributor III

Re: Default

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
Contributor III

Re: Default

hI

ATTACHING THE SAMPLE

MVP
MVP

Re: Default

I guess, simple rank() could work here.

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

Capture.JPG

try the same search string in OnOpen trigger.

Re: Default

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
Contributor III

Re: Default

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