2 Replies Latest reply: Aug 27, 2018 2:40 AM by Petter Skjolden RSS

    help on date sorting?

    daisy ch

      Hi

       

      I have one date field and data like below.

       

      date

      10-jun-2017

      11-mar-2017

      20-apr-2018

      9-jan-2017

      30-dec-2016

      23-nov-2016

      10-dec-2018.

       

      The above dates not in order. I need the data in proper order like minimum to maximum dates.

       

      23-nov-2016

      30-dec-2016

      9-jan-2017

      11-mar-2017

      10-jun-2017

      20-apr-2018

      10-dec-2018  like that.

       

      How to sorting the above data. Please  help on this.

       

      Thanks

        • Re: help on date sorting?
          Petter Skjolden

          If you make sure that the date field has values that are proper dates then they will sort properly if you don't override the sorting in any way.

           

          Check to see if the field contains the dates as actual dates and not just as textual dates. You can check that in your Data Model Viewer by looking at the tags and see if the field has the tags   $date and  $timestamp.

           

          To ensure that textual dates come in as real dates you can do this in your load script:

           

          LOAD
             .....
             Date( Date#( SalesDate , 'DD-MMM-YYYY' ) AS SalesDate,
            ......
          
          
          • Re: help on date sorting?
            Arvind Patil

            Hi Daisy,

             

            Please convert your date into below format and sort:

             

            Date(Date#(date,'DD-MMM-YYYY') as Date,


            Now sort this as you like.


            Thanks,

            Arvind Patil