This article will help you to:

  • Compare data over two Date Ranges in a Line Chart
  • Understand the offset function in the advanced view

The following example explains how to compare a metric over the last month with the same metric over the same month of the previous year.

Comparing two data series in a Line Chart

  • Start by creating a Line Chart (read the article to create your first Widget).
  • Let's take Date (cross-API) as dimension and Sessions as metric.
Creating a Line Chart
  • Double-click on the Widget to enter the advanced view. Duplicate the metric from column A. Set the Date Range of the new column to "Same Days Last Year".
Duplicate your first column
  • Since the Widget dimension is a Date, Reeport displays the days one after the other. It is therefore necessary to create a Relation metric to put the two metrics on an equal footing. To do so, create a third column and change the type of the metric from "API" to "Rel".
Create a relational metric
  • You can now use the offset(X,n) function which returns the value from column X, n rows before the current row. Here you can type offset(B,31) since March contains 31 days. You can also use the formula offset(B,sum(if_else(A==0,1,0))) so that this calculation remains dynamically valid for all months of the year.
  • Hide column B and then set the display threshold in column C to 1, to hide the empty cells.
Use the offset function
  • You can now style your Widget: rename your metrics, then choose their format. Modify the title, adjust the colors or the size, it's up to you!
Style & format the widget

Did this answer your question?