SSRS Report: Date addition, subtraction

Scenario: 
I want to subtract 7 days from the date I choose in the date parameter

Solution:
In the expression write=Dateadd(“d”,-7,Parameters!RefDate.Value)

Scenario:
I want just change the year part of the Date field. Changing 365 days does not work because of the leap year.

Solution:
SQL Command:

UPDATE dbo.TableToUpdate
  SET [Date Column] = DATEADD(YEAR, -2, [Date Column]);

SSRS Command:

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s