question

Arun chougule avatar image
Arun chougule asked

How to get last year date same as getdate?

I am working on a reporting project using ssrs. there is a requirement to calculate 7 year avg of incident. but user send fromdate and todate parameter then how to get last 7 years same time span.

datetime
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
TG avatar image
TG answered

use DATEADD to get a new date based on another date. So seven years ago from this instant would be: DATEADD(year, -7, getdate())

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.