[Lens] Docs for time shift (#102048)

This commit is contained in:
Joe Reuter 2021-06-17 09:32:28 +02:00 committed by GitHub
parent fd5883b465
commit c75f369536
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

View file

@ -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