Working with Date Variables

Chartio's relative date variables allow you to generate a custom date that can be used anywhere you would enter a date value.

For an overview of Relative Date Variables, see our documentation.


Interactive Mode filtering

Create a chart to compare this calendar week's sales to the previous calendar week.

Our first dataset uses the "current week" filter to get the sum of payments for the current week.

Our second dataset uses relative date variables to filter by the previous calendar week.

To recreate the chart above, select Union as the Merge type, check the Add Dataset Names checkbox, and select a Bar chart as your chart type.

In the Data Pipeline

We want to filter out the current month from our chart data. Because we're using multiple datasets, it's easiest to do this in the Data Pipeline with a Filter step. Our chart dates are grouped by month, so we need to use the BUCKET function to return the month and year of the current month.

Dashboard filter defaults

We want our calendar filter to default to the previous month, so we'll use the following for the default start and end dates: