Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Lens] Docs for time shift #102048

Merged
merged 3 commits into from
Jun 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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]
flash1293 marked this conversation as resolved.
Show resolved Hide resolved

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