Visual Studio - Life Runs on Code

Subtract days, weeks etc in SSRS

Yet another useful date subtraction technique, this time via SSRS and expressions. If you're not using SQL datasets to calculate your dates and times, then this will be of use to you:

=DATEADD(DateInterval.Year, -1, Today())
=DATEADD(DateInterval.Year, -1, Fields!StartDate.Value)
=DATEADD("M",-1,Today())
=DATEADD("M",-1,Fields!StartDate.Value)
=DATEADD(DateInterval.WeekOfYear, -1, Today())
=DATEADD(DateInterval.WeekOfYear, -1, Fields!StartDate.Value)
=DATEADD("D", -1, Today())
=DATEADD("D", -1, Fields!StartDate.Value)

2 comments

Leave a reply