hashtag
hashtag

Reputation: 63

Reporting services expression for default value

the following error is displayed when deploy reports, "The Value expression for the report parameter ‘Year’ contains an error: [BC30201] Expression expected "

The problem is in default value expression for parameter Year.

=Switch(
CInt(System.DateTime.Now.Month) >3,
    Year(Today()),
CInt(System.DateTime.Now.Month) <=3,
    {Year(Today.AddYears(-1)),Year(Today())}

)

Any idea?

Upvotes: 1

Views: 1753

Answers (1)

Ian Preston
Ian Preston

Reputation: 39586

I'm pretty sure you can just rewrite the above as:

=IIf(Month(Today) > 3, Year(Today), Year(DateAdd(DateInterval.Year, -1, Today)))

i.e. If Today is in April to December, use the current year, else use the previous year.

Upvotes: 1

Related Questions