Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
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?

Thanks!

3 Replies
crusader_
Partner - Specialist
Partner - Specialist

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.

Regards,

Andrei Kaliahin

Not applicable
Author

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.

jonathandienst
Partner - Champion III
Partner - Champion III

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

          Date,

          Month(Date) As Month,

          Year(Date) As Year,

          Amount,

          ...

         

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