Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
daisy1438
Contributor III
Contributor III

help on date sorting?

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

2 Replies
petter
Partner - Champion III
Partner - Champion III

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,

  ......

arvind_patil
Partner - Specialist III
Partner - Specialist III

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