Andy Williams
Andy Williams

Reputation: 907

SSRS Report Date Parameter Default for the current Year

I have an SSRS Report I've created with a "Date/Time" Parameter I have created. I am trying to create a Parameter that Defaults to the Current Year. For example in "2020" I want the Paramater to default to "01/01/2020" when we hit 2021 I want it to default to "01/01/2021" Here is what I have tried. For my default value in the parameter I have the following expression with no success.

=CDate(Year(Now())+"-"+Month(01)+"-"+Day(01))

Upvotes: 1

Views: 4794

Answers (1)

Alan Schofield
Alan Schofield

Reputation: 21683

You can do this using the following expression.

=DateSerial(YEAR(Today()), 1, 1)

You can use CDate but that relies on strings. DateSerial is easier to work with in your scenario.

Upvotes: 5

Related Questions