Pages

Thursday, January 16, 2014

Calculate Date Example

Sometimes it is very useful to use a calculated earlier date (e.g. yesterday, a month ago) as a default parameter value on a report. For example, if you want a report to run every day for the previous day, you might want to add a calculation of 'yesterday' for the default value of the parameter.

Implementation Steps

To calculate 'yesterday' in the report designer use the following formula in the 'default value formula' or 'post processing formula' of the parameter:

=DATEVALUE(DATE(YEAR(TODAY()-1);MONTH(TODAY()-1);DAY(TODAY()-1)))
To calculate '12 month ago' in the report designer use the following formula in the 'default value formula' or 'post processing formula' of the parameter:

=DATEVALUE(DATE(YEAR(TODAY());MONTH(TODAY())-12;DAY(TODAY())))
 
Here is the oiginal Post

No comments:

Post a Comment