Skip to content

Commit f8b2c0b

Browse files
committed
Add metrics prefix to sample code
1 parent 4123776 commit f8b2c0b

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ from {{ metrics.metric(
4040
grain='week',
4141
dimensions=['plan', 'country'],
4242
secondary_calculations=[
43-
period_over_period(comparison_strategy="ratio", interval=1, alias="pop_1wk"),
44-
period_over_period(comparison_strategy="difference", interval=1),
43+
metrics.period_over_period(comparison_strategy="ratio", interval=1, alias="pop_1wk"),
44+
metrics.period_over_period(comparison_strategy="difference", interval=1),
4545

46-
period_to_date(aggregate="average", period="month", alias="this_month_average"),
47-
period_to_date(aggregate="sum", period="year"),
46+
metrics.period_to_date(aggregate="average", period="month", alias="this_month_average"),
47+
metrics.period_to_date(aggregate="sum", period="year"),
4848

49-
rolling(aggregate="average", interval=4, alias="avg_past_4wks"),
50-
rolling(aggregate="min", interval=4)
49+
metrics.rolling(aggregate="average", interval=4, alias="avg_past_4wks"),
50+
metrics.rolling(aggregate="min", interval=4)
5151
]
5252
) }}
5353
```
@@ -73,23 +73,23 @@ Column aliases are [automatically generated](#secondary-calculation-column-alias
7373

7474
## Period over Period ([source](/macros/secondary_calculations/secondary_calculation_period_over_period.sql))
7575

76-
Constructor: `period_over_period(comparison_strategy, interval [, alias])`
76+
Constructor: `metrics.period_over_period(comparison_strategy, interval [, alias])`
7777

7878
- `comparison_strategy`: How to calculate the delta between the two periods. One of [`"ratio"`, `"difference"`]. Required
7979
- `interval`: The number of periods to look back. Required
8080
- `alias`: The column alias for the resulting calculation. Optional
8181

8282
## Period to Date ([source](/macros/secondary_calculations/secondary_calculation_period_to_date.sql))
8383

84-
Constructor: `period_to_date(aggregate, period [, alias])`
84+
Constructor: `metrics.period_to_date(aggregate, period [, alias])`
8585

8686
- `aggregate`: The aggregation to use in the window function. Options vary based on the primary aggregation and are enforced in [validate_aggregate_coherence()](/macros/secondary_calculations/validate_aggregate_coherence.sql). Required
8787
- `period`: The time grain to aggregate to. One of [`"day"`, `"week"`, `"month"`, `"quarter"`, `"year"`]. Must be at equal or lesser granularity than the metric's grain (see [Time Grains](#time-grains) below). Required
8888
- `alias`: The column alias for the resulting calculation. Optional
8989

9090
## Rolling ([source](/macros/secondary_calculations/secondary_calculation_rolling.sql))
9191

92-
Constructor: `rolling(aggregate, interval [, alias])`
92+
Constructor: `metrics.rolling(aggregate, interval [, alias])`
9393

9494
- `aggregate`: The aggregation to use in the window function. Options vary based on the primary aggregation and are enforced in [validate_aggregate_coherence()](/macros/secondary_calculations/validate_aggregate_coherence.sql). Required
9595
- `interval`: The number of periods to look back. Required

0 commit comments

Comments
 (0)