Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

Working with dates

Good morning,

I have a problem with dates.

This is what I want to achieve:

     I have all the dates of the last three years;

     I choose a date range selecting the dates that i want to analyze (i.e: from the 1st of January to the 31 of July 2015);

     Qlik returns the revenue made in the selection, and in the same selected period but of an year ago( so, from the 1st of January to the      31 of July 2014);

How can I do this?


Tags (1)
3 Replies
Valued Contributor

Re: Working with dates

Hello Patrizio,

Please check my example. To achive your requirement you have to use set analysis in your expressions where you want to show previous period. It could be smth like below:

    sum({<Year={$(=max(Year)-1)}>} Sales)

Hope this helps you.


Andrei Kaliahin

Not applicable

Re: Working with dates

can u please explain how do u want. if u select 2015 then what would u want to see the data of 2015 or 2014.


Re: Working with dates

This is simple if you create a set of calendar fields, such as in a master calendar. In its simplest form, do this when you load from the source that contains the date:

     LOAD ...


          Month(Date) As Month,

          Year(Date) As Year,




Now if you make selections on Month, you can write expressions like:

     =Sum({<Year = {"$(=Max(Year))"}>} Amount)

     =Sum({<Year = {"$(=Max(Year)-1)"}>} Amount)

to view the values for the month for the this year and for last year.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Community Browser