Reputation: 144
I have a requirement for an SSRS parameter that will be for a start date of the most 1st April, so today it will report from 1/4/2015 with 10 weeks data, but after the 1/4/16 it will default to 1/4/16.
Can anyone help with this please?
I can find most recent month, or current month etc, but this one is a little tricky. Thankyou.
I am using SQL Server 2012 and Visual Studio 2010
Upvotes: 0
Views: 778
Reputation: 5405
You could use the following expression:
=IIF(Today() >= DateSerial(Year(Today()), 4, 1), DateSerial(Year(Today()), 4, 1), DateSerial(Year(Today()) - 1, 4, 1))
The idea is to check if the 1st of April of the current year has been reached (Today() >= DateSerial(Year(Today()), 4, 1)
).
DateSerial(Year(Today()), 4, 1)
DateSerial(Year(Today()) - 1, 4, 1)
Upvotes: 1