0
votes

I am trying to set a simple expression in SSRS in my report using the datepart function:

=datepart("dw",Fields!period_dt.Value)

When I preview the report, the values come up as #error.

Am I missing something completely obvious here?

The Fields!period_dt.Value field contains dates in this format 12/31/2013 12:00:00

1

1 Answers

0
votes

In your expression:

=datepart("dw",Fields!period_dt.Value)

dw is not a valid datepart.

Assuming you want the day of the week, use:

=datepart("w",Fields!period_dt.Value)

or

=datepart(DateInterval.Weekday,Fields!period_dt.Value)

Which both return 3 for 12/31/2013 12:00:00.

See DatePart Function for more details on this.