user3348557
user3348557

Reputation: 89

SSRS datepart #error in report

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

Upvotes: 0

Views: 1034

Answers (1)

Ian Preston
Ian Preston

Reputation: 39566

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.

Upvotes: 0

Related Questions