3 Replies Latest reply: Jul 7, 2015 3:17 AM by Jonathan Dienst RSS

    Working with dates

    Stella Patrizio

      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!

        • Re: Working with dates
          Andrei Kaliahin

          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

          • Re: Working with dates
            rasool ahammad

            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
              Jonathan Dienst

              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.