Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 general forum
Suggested answer

Formatting Date fields in SSRS reports

Posted on by 85

Hello. Any date field from Dynamics 365 that I bring in to an SSRS report with a FetchXML data set, is not recognized as a date.  I can display the data without any issue, but I can't format the field to some how convert the string into a date field. I suspect it has to do with the time value in the field.

I have tried the formula: 
=Format(CDate(Left(Fields!createdon.Value,10)))

This works with many of the values, but unfortunatley, not all of the values (perhaps because they don't have a time in the date field?)

timestamp.PNG

Below is an example of the above column, and the data without any formatting.  I can't see a reason for why the formula would work on some of the values, but not the others.  This is the "Created On" field that is in all entities.

 date-with-both.PNG

I would appreciate suggestions for how to solve this.  Thank you!

  • unicorn_tech Profile Picture
    unicorn_tech 85 on at
    RE: Formatting Date fields in SSRS reports

    Interesting. Though I'm not using an IF function here. My goal is just to sort by date, which I can't do if the date can't be formatted as such.

  • Suggested answer
    Nya Profile Picture
    Nya 29,050 on at
    RE: Formatting Date fields in SSRS reports

    Hi,

    Some values in an expression can evaluate to null or undefined at report processing time. This can create run-time errors that result in #Error displaying in the text box instead of the evaluated expression. The IIF function is particularly sensitive to this behavior because, unlike an If-Then-Else statement, each part of the IIF statement is evaluated (including function calls) before being passed to the routine that tests for true or false. The statement =IIF(Fields!Sales.Value is NOTHING, 0, Fields!Sales.Value) generates #Error in the rendered report if Fields!Sales.Value is NOTHING.

    Please refer to the following section which may help you.

    Suppressing Null or Zero Values at Run Time

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 288,584 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,864 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans