How to run your SSRS Report for Past “N” Days from the Report run Date

Introduction

If have a parameter on our report to see the past “N” days data on our report, we can perform the following steps.

Step 1:

Add a new Parameter, say “Days”

Step 2:

Under the Available Values Section, Add a new Value for the Parameter with value as 7 and expression having the following formula:

=DateAdd(“d”,-7,Globals!ExecutionTime)

Step 3:

Under the Default Values Section, Add a new Value for the Parameter with expression having the following formula:

=DateAdd(“d”,-7,Globals!ExecutionTime)

Step 3:

In your Dataset, add the following Filter Condition in the XML.

<filter type=”and”>

<condition attribute =”modifiedon”  operator=”on-or-after” value=”@Days” />

</filter>

Conclusion

Thus, now you can view your report with records modified in the past “N” days.


Share Story :

Secured By miniOrange