This article will detail how to set dynamic date ranges that adjust based on the current date in saved (memorized) reports.
When you save a report by clicking on the bookmark link, you may have noticed that when you go back to that report at a later date, the date ranges in the report are still the same as they were on the day that you saved the report. They no longer update dynamically whenever you open the report. To change this behavior take the following steps:
- Find the saved report configuration by clicking on Reports in the sidebar then clicking on View existing report configurations.
- Search for the report title in the search field.
- The report configuration must be of the type "Link."
- Check the box to select the report configuration.
- Click the Edit Selected Report Configuration(s) button.
- Edit the URL of the saved report configuration.
- Click in the Url: text field and press Ctrl-A to select all and then Ctrl-C to copy.
- Open Notepad and paste the URL with Ctrl-V.
- Identify the Date values we need to change. The URL will have the slashes in the date value re-encoded to %2F. Spaces will be re-encoded to %20 and colons to %3A. Include the time along with the date if it appears. In the example below I have highlighted the date and time values. Notice that they appear shortly after the text "fromDate" and "toDate", and that they will be between Value= and &.
- Replace the Date values with one of the following values:
- DAYSPREVIOUS:X where X is a number, 0 being today, 1 being yesterday, 30 being 30 days ago, and so on.
- DAYSPREVIOUSEND:X the same as DAYSPREVIOUS, except the time will be set to 23:59:59 instead of 00:00:00.
- MONTHSPREVIOUS:X where X is a number, 0 being this month, 1 being last month, and so on. This will produce a date equal to the first day of the month. For example, if today is 8/21/2019, MONTHSPREVIOUS:1 will produce a date of 7/1/2019.
- MONTHSPREVIOUSEND:X where X is a number, 0 being this month, 1 being last month, and so on. This will produce a date equal to the last day of the month. For example, if today is 8/21/2019, MONTHSPREVIOUSEND:1 will produce a date of 7/31/2019.
- Below is an example of how to replace the date values so that the report will always open with a start date of the first day of the previous month and an end date of today.
- In Notepad, press Ctrl-A to select all and then Ctrl-C to copy.
- Go back to the Url: field of the saved report configuration and press Ctrl-A to select all and then Ctrl-V to paste. Click the Save button.
- Test the report. It should now open with the desired date range.