8 Replies Latest reply: Dec 5, 2011 9:51 AM by Ashok Chandran RSS

    Date comparisions

      Hi there.

       

      I'm quite new to Qlikview.

      I have a basic question.

       

      Let's say this is my database

       

      MonthYearPeriodValue
      11201011.201035
      12201112.201138
      12011  1.201150
      22011  2.201133
      32011  3.201134
      42011  4.201148
      52011  5.201147
      62011  6.201143
      72011  7.201130
      82011  8.201141
      92011  9.201142
      10201110.201135
      11201111.201132

       

      After import I have a month, year, period the value field.

       

      What I want to do now, is creating a chart, with dates correct ordened, so like this :

      value.JPG

      How do I do that? because qlikview sorts the row values from 1 to 10, which means that 11.2010 is at the back together with 11.2011

       

      Thanks!

        • Re: Date comparisions
          Miguel Angel Baeyens de Arce

          Hi,

           

          I'd create a field date, which is dual (literal representation, numeric value) so you can sort by this field instead:

           

          Data:
          LOAD *, MakeDate(Year, Month) AS Date INLINE [
          Month, Year, Period, Value
          11, 2010, 11.2010, 35
          12, 2011, 12.2011, 38
          1, 2011, 1.2011, 50
          2, 2011, 2.2011, 33
          3, 2011, 3.2011, 34
          4, 2011, 4.2011, 48
          5, 2011, 5.2011, 47
          6, 2011, 6.2011, 43
          7, 2011, 7.2011, 30
          8, 2011, 8.2011, 41
          9, 2011, 9.2011, 42
          10, 2011, 10.2011, 35
          11, 2011, 11.2011, 32
          ];
          

           

          Now, although the chart will look like the same, go to teh chart properties, Sort, and sort Numeric Ascending or Expression, Ascending, Date.

           

          Hope that helps.

           

          Miguel

          • Date comparisions

            Hi there,

            I would use the dual()-function similar to this:

            Load

            . . .

                dual(Month(RawDate) & '-' & Year(RawDate), Year(RawDate) & num(Month(RawDate),'00'))

                                                        AS Period,

            . . .

            The dual() creates a numeric/text field "Period" similar to the Month()-function. Now users see the  string-representation of the "numeric" field but sorting can be done numerical.

            HtH

            Roland

            • Date comparisions

              how stupid of me, now i understand it , sorry Roland

              • Re: Date comparisions
                Ashok Chandran

                Hi,

                 

                     I have attached one example qlikview file for your referrence,May be it will helpful for you to get some idea about qlikview .

                • Re: Date comparisions
                  Ashok Chandran

                  Hi,

                   

                       Find the attached file may be this solution will be helpful for your doubt...