One of the primary applications of Global Variables is to create dynamic filters.
Example
Suppose you have a report with an input parameter named Date
Now suppose you want to filter the Order Date column with the range of the first day of the month through the last day of the month based on the Date entered.
To accomplish this:
- Open the variables editor
- Add a new calculation: First Day of Month
- For the input, change to Literal, use the filter visual assist button and select the Date parameter (in general, Parameters and variables are reference by their name enclosed in angle brackets: e.g. <Date>)
Do the same steps, this time add a new calculation Last Day of Month
Now add a Concatenation calculation to create the filter string for the range filter (See Filter a Range)
Rename the Caption to Filter. The Concatentation example above shows how you can combine the other variables into a new variable that will server as the filter string. Note the Value column shows that the filter evaluation is what we want.
Click Save and Close to save your changes
Click the visual assist on the Order Date filter column. Select Variables -> <Filter>
Now the Order Date filter tracks the first and last day of the month of whatever date you enter in the Date parameter of the report