Skip to content

Commit

Permalink
[Lens] Docs for time shift (#102048)
Browse files Browse the repository at this point in the history
  • Loading branch information
flash1293 committed Jun 17, 2021
1 parent fd5883b commit c75f369
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
Binary file added docs/user/dashboard/images/lens_time_shift.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions docs/user/dashboard/lens-advanced.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,41 @@ image::images/lens_advanced_5_2.png[Line chart with cumulative sum of orders mad

. Click *Save and return*.

[discrete]
[[compare-time-ranges]]
=== Compare time ranges

*Lens* allows you to compare the currently selected time range with historical data using the *Time shift* option.

Time shifts can be used on any metric. The special shift *previous* will show the time window preceding the currently selected one, spanning the same duration.
For example, if *Last 7 days* is selected in the time filter, *previous* will show data from 14 days ago to 7 days ago.

If multiple time shifts are used in a single chart, a multiple of the date histogram interval should be chosen - otherwise data points might not line up in the chart and empty spots can occur.
For example, if a daily interval is used, shifting one series by *36h*, and another one by *1d*, is not recommended. In this scenario, either reduce the interval to *12h*, or create two separate charts.

To compare current sales numbers with sales from a week ago, follow these steps:

. Open *Lens*.

. From the *Chart Type* dropdown, select *Line*.

. From the *Available fields* list, drag and drop *Records* to the visualization builder.

. Copy the *Count of Records* series by dragging it to the empty drop target of the *Vertical axis* dimension group (*Drop a field or click to add*)

. Shift the second *Count of Records* series by one week to do a week-over-week comparison

.. Click the new *Count of Records [1]* dimension

.. Click *Add advanced options* below the field selector

.. Click *Time shift*

.. Click the *1 week* option. You can also define custom shifts by typing amount followed by time unit (like *1w* for a one week shift), then hit enter.

[role="screenshot"]
image::images/lens_time_shift.png[Line chart with week-over-week sales comparison]

[discrete]
[[view-customers-over-time-by-continents]]
=== View table of customers by category over time
Expand Down

0 comments on commit c75f369

Please sign in to comment.