Skip to main content
Dynamics 365 general forum
Suggested answer

Formatting Date fields in SSRS reports

editSubscribe (0) ShareShare
ReportReport
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,043 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

What Motivates a Super User?

We know many of you visit the Dynamics 365 Community and Power Platform…

Demystifying Copilot with Georg Glantschnig…

Industry experts answer burning questions directly from our amazing Community…

Setting Up Knowledge Sources for Copilot…

Look at how configuring a comprehensive knowledge base is crucial…

Leaderboard

#1
Andre Arnaud de Calavon Profile Picture

Andre Arnaud de Cal... 283,066 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 222,585 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,138

Product updates

Dynamics 365 release plans