You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Computes a 28-day rolling average for both ratio and sum.
208
+
- Creates period-over-period comparisons over a 365-day window, producing measures for:
209
+
- Previous values
210
+
- Relative changes
211
+
212
+
Supported types (`kinds`) of period-over-period comparisons are:
213
+
214
+
- Previous: Returns the historical value from the prior period.
215
+
- Difference: Subtracts the previous period from the current.
216
+
- Relative Change: Shows percentage change between periods.
217
+
218
+
These measures work with different time period granularities (day, week, quarter, ...), with automatic smart period adjustments (e.g., 30 days ≈ 4 weeks ≈ 1 month).
219
+
192
220
### `[dimensions]` Section
193
221
194
222
Dimensions define a field or dimension on which the client population should be segmented. Dimensions are used in OpMon. For segmenting client populations clients see the `[segments]` section.
@@ -340,6 +368,9 @@ The side pane is split into different sections:
340
368
-**Statistics**: This sections contains the [statistics that have been defined in metric-hub on top of the metric definitions](https://github.com/mozilla/metric-hub/tree/main/looker) as measures. These statistics summarize the distribution of metrics within a specific time frame, population and/or segment and are used to derive insights and patterns from the raw metric data. Statistics have to be defined manually under the [`looker/` directory in metric-hub](https://github.com/mozilla/metric-hub/tree/main/looker).
341
369
-**Sample of source data**: Defines the sample size that should be selected from the data source. Decreasing the sample size will speed up getting results in Looker, however it might decrease the accuracy. The results are being adjusted based on the sample size. For example, if a 1% sample is being used, then certain statistic results (like sum, count) will be multiplied by 100.
342
370
-**Aggregate Client Metrics Per ...**: This parameter controls the time window over which metrics are aggregated per client. For example, this allows to get a weekly average of a metric, a maximum of a metric over the entire time period. By default, aggregations are on a daily basis.
371
+
-**Lookback (Days)**: Adds a configurable buffer of days before the selected analysis period (useful for period-over-period calculations).
372
+
-**Analysis Period (with Lookback)**: Defines the primary analysis window for all comparisons.
373
+
-**Date Group By Position**: Helps resolve grouping when using week/month/quarter/year granularity in BigQuery.
343
374
344
375
#### Getting Metrics into Looker
345
376
@@ -355,6 +386,7 @@ Statistics on top of these metrics need to be defined in the [`looker/` folder i
355
386
-`client_count`: distinct count of clients where the metric value is >0
356
387
-`ratio`: ratio between two metrics. When configuring the statistic metric slugs need to be provided for the `numerator` and `denominator` parameters
357
388
-`dau_proportion`: Ratio between the metric and active user counts
389
+
-`rolling_average`: Configurable rolling average of a statistic
358
390
359
391
To get more statistics added, please reach out on the [#data-help](https://mozilla.slack.com/archives/C4D5ZA91B) Slack channel.
360
392
@@ -429,3 +461,12 @@ Definitions for metrics can be encoded at different levels. It is preferable to
429
461
Ideally, metrics should be defined in the `[metrics]` section. However in some cases metrics might rely on more complex logic. For example, if some more complicated unnesting of fields or `JOIN`s across multiple tables are required it might make sense to move the metric computation into the `[data_sources]` definition and then simply reference the field in the `[metrics]` section. The main drawback of this is that if users want to find the definition they will have to go one layer deeper and check how the data source is defined versus just having to look at the metric definition itself.
430
462
431
463
For computationally expensive metrics it can make sense to set up an ETL job that computes the metrics on a daily basis and writes results to a separate table. This table can serve as basis of a data source which can then be used to define a metric.
464
+
465
+
### How are period-over-period comparisons computed?
466
+
467
+
Metric Hub automatically generates LookML for period-over-period measures. It uses:
468
+
469
+
- LAG functions for standard statistics (e.g., sum, ratio).
470
+
- Adjusted rolling windows for rolling averages (window size adapts to chosen time granularity).
471
+
472
+
If no appropriate `submission` field is selected, Looker will raise an error prompting you to choose one.
0 commit comments