web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

SSRS Sort by Date goes from 31/01/2018 to 01/01/2019 instead of 01/02/2018

(0) ShareShare
ReportReport
Posted on by

Hello friends,

I've created a report for our events team that organises all their service calendar bookings by date for the whole year. The table is currently sorting on Scheduledstart field which returns as mm/dd/yyyy hh:mm, such as 1/23/2018 14:00, which up til now has been fine (i changed the number format of the column to just be date in the UK format, 23/1/2018.

However, now that they are putting in bookings for 2019, the sorting jumps from 31/01/2018 to showing bookings from 01/01/2019. It's as though it doesn't recognise it as a date/time that is a year later and rather one number/character increased. I'm not sure how to get this value to operate as a date, perhaps something in the SQL command for the dataset?

The question is how do we get this show chronologically and go to February 2018, only going to January 2019 after the end of December 2018?

Many thanks in advance!

*This post is locked for comments

I have the same question (0)
  • David Jennaway Profile Picture
    14,065 on at

    Is this a SQL or Fetch-based report ? If it's a Fetch-based report, you'll get 2 fields that represent each DateTime field - for Scheduledstart you'd get:

    • Scheduledstart - this will be a text field
    • ScheduledstartValue - this will be a datetime field

    To get the sorting you want, you'll need to sort by the datetime field - i.e. ScheduledstartValue

  • Community Member Profile Picture
    on at

    Hi David,

    Thanks for chipping in! This is a SQL pulled dataset, is it possible to get this functionality with SQL?

  • Suggested answer
    Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    If your data is in string format, you can use the CONVERT function in SQL to convert into from a string value into a numeric value. You can also convert it within your SSRS report as a calculate field.

    You can use something like this to sort:

    SELECT new_invoicedate FROM Filterednew_Invoice

    ORDER BY convert(nvarchar(10), new_invoicedate, 111) ASC

    Take a look at the following link for formats that you can use for sorting and decide which one will work for you:

    www.sqlinfo.net/.../sql_server_SELECT-Formatting_Date_Time.php

    Hope this helps.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans