Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I'm currently on my first QV steps, so I really appreciate any help.
I want to automatically select a range of month-year dates when clicking on a text box with an action set. The selection has to be last12 months from 2 months before now. For instance, if we are now 03-2014 the selection should be from 01-2013 to 12-2013. I set the variables for the range bounds:
v1: Date(MonthName(Date(MonthStart(AddMonths(Max({1} Datefield),-2))-1)), 'MM-YYYY')
v2: Date(MonthName(Date(MonthStart(AddMonths(Max({1} Datefield),-13))-1)), 'MM-YYYY')
If I add a Field Selection action in the text box:
Field -> DateField
String -> =$(v1)
it works fine, so v1 and v2 are ok.
I couldn't make it work when I tried to select the whole range from v1 to v2 (month-year). I found some solutions based on concat(.....|....), but the inside text was always strings, not variables.
Thanks.
It would be better if you have enclosed a sample file or sample apps...
The approach I would use for this is:
1) Have a calendar that has an 'ISMonths-2-14' flag field (i.e. 1 or 0)
2) Create a button that has multiple actions
a) Select In Field 'ISMonths-2-14'
b) Select Possible [your months field]
c) Clear field 'ISMonths-2-14'
This would give the illusion to the end user of QlikView directly selecting the 12 months you want.
Hi,
Today ----> 03-2014
Create variables
Ex:
vBackDate = Date(AddMonths(Monthstart(Today()),-2),'MM-YYYY') ----> 01-2014
vFutureDate = Date(YearEnd(Today()),'MM-YYYY') ----> 12-2014
Button/AnyAction :
Field ---> Your Date Field (MM-YYYY)
SearchString : ='>='&vBackDate&'<='&vFutureDate
Manish,
OK, I attached a file.
Thanks
Use like this
='>='&$(vSelectTAM2)&'<='&$(vSelectTAM1)
David,
I finally chose your option. Defined in script and simplier to set.
Thanks
I was trying in this way, but I finally chose the other solution posted. Also thank you anyway.
Simpler is usually better