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: 
Not applicable

Month slider that sets a variable

I am trying to create a month slider that can set a variable.  I want to be able to write in set analysis for certain charts something along the lines of {<MonthYear={'$Variable'}>}.  I want the slider to show all the Months in our time period for our data in the format of 'MMM-YY'.  I tried to do Min(MonthYear) for the minimum value and both Max(MonthYear) and Date(MonthStart(today()), 'MMM-YY') for the maximum value with my variable in the Data section of the slider.  This only changed the variable to one value instead of a group of values or in other cases gave me completely wrong values for the slider.  I would really appreciate some help with this issue.  Thanks in advance!   

1 Reply
stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

With the Min and Max you refer to this will alter based on your current selection - which you probably don't want. You could try:

min({1}MonthYear)  and max({1}MonthYear)

The {1} in both cases telling QlikView to ignore any selections.

You will also want to ensure that the month value on the slider is a formatted date with only one value per month (eg. the frist day).  To do this have the following in your load script:

Date(monthstart(MonthYear), 'MMM-YY') as MonthYear

Finally, set analysis is quite picky about date formats, and I would imagine the $Varaible will just contain a number for the date rather than the formatted date.  The best way around this is to have two variables, one on the slider and a formatted one to use in Set Analysis.

Create a variable called vFormatedVar and set it to =Date(Variable, 'MMM-YY')

Use this in Set Analysis rather than the slider variable, eg.  sum({<MonthYear=$(vFormattedVar)>}Value)

If things are still not working out perhaps you could post an example .qvw showing how it is not working.

- Steve

http://www.quickintelligence.co.uk/