Skip to content

Commit 74dfc54

Browse files
Metric date (dbt-labs#6428)
## What are you changing in this pull request and why? Enhancing examples https://dbt-labs.slack.com/archives/C02NCQ9483C/p1730927629130439 ## Checklist - [ ] I have reviewed the [Content style guide](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/content-style-guide.md) so my content adheres to these guidelines. - [ ] The topic I'm writing about is for specific dbt version(s) and I have versioned it according to the [version a whole page](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/single-sourcing-content.md#adding-a-new-version) and/or [version a block of content](https://github.com/dbt-labs/docs.getdbt.com/blob/current/contributing/single-sourcing-content.md#versioning-blocks-of-content) guidelines. - [ ] I have added checklist item(s) to this list for anything anything that needs to happen before this PR is merged, such as "needs technical review" or "change base branch." - [ ] The content in this PR requires a dbt release note, so I added one to the [release notes page](https://docs.getdbt.com/docs/dbt-versions/dbt-cloud-release-notes). <!-- PRE-RELEASE VERSION OF dbt (if so, uncomment): - [ ] Add a note to the prerelease version [Migration Guide](https://github.com/dbt-labs/docs.getdbt.com/tree/current/website/docs/docs/dbt-versions/core-upgrade) --> <!-- ADDING OR REMOVING PAGES (if so, uncomment): - [ ] Add/remove page in `website/sidebars.js` - [ ] Provide a unique filename for new pages - [ ] Add an entry for deleted pages in `website/vercel.json` - [ ] Run link testing locally with `npm run build` to update the links that point to deleted pages --> <!-- vercel-deployment-preview --> --- 🚀 Deployment available! Here are the direct links to the updated files: - https://docs-getdbt-com-git-metric-date-dbt-labs.vercel.app/docs/build/measures <!-- end-vercel-deployment-preview -->
1 parent 451af64 commit 74dfc54

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

website/docs/docs/build/measures.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ Parameters under the `non_additive_dimension` will specify dimensions that the m
200200

201201
```yaml
202202
semantic_models:
203-
- name: subscription_id
203+
- name: subscriptions
204204
description: A subscription table with one row per date for each active user and their subscription plans.
205205
model: ref('your_schema.subscription_table')
206206
defaults:
@@ -209,7 +209,7 @@ semantic_models:
209209
entities:
210210
- name: user_id
211211
type: foreign
212-
primary_entity: subscription_table
212+
primary_entity: subscription
213213
214214
dimensions:
215215
- name: subscription_date
@@ -224,21 +224,21 @@ semantic_models:
224224
expr: user_id
225225
agg: count_distinct
226226
non_additive_dimension:
227-
name: metric_time
227+
name: subscription_date
228228
window_choice: max
229229
- name: mrr
230230
description: Aggregate by summing all users' active subscription plans
231231
expr: subscription_value
232232
agg: sum
233233
non_additive_dimension:
234-
name: metric_time
234+
name: subscription_date
235235
window_choice: max
236236
- name: user_mrr
237237
description: Group by user_id to achieve each user's MRR
238238
expr: subscription_value
239239
agg: sum
240240
non_additive_dimension:
241-
name: metric_time
241+
name: subscription_date
242242
window_choice: max
243243
window_groupings:
244244
- user_id
@@ -255,15 +255,15 @@ We can query the semi-additive metrics using the following syntax:
255255
For dbt Cloud:
256256

257257
```bash
258-
dbt sl query --metrics mrr_by_end_of_month --group-by metric_time__month --order metric_time__month
259-
dbt sl query --metrics mrr_by_end_of_month --group-by metric_time__week --order metric_time__week
258+
dbt sl query --metrics mrr_by_end_of_month --group-by subscription__subscription_date__month --order subscription__subscription_date__month
259+
dbt sl query --metrics mrr_by_end_of_month --group-by subscription__subscription_date__week --order subscription__subscription_date__week
260260
```
261261

262262
For dbt Core:
263263

264264
```bash
265-
mf query --metrics mrr_by_end_of_month --group-by metric_time__month --order metric_time__month
266-
mf query --metrics mrr_by_end_of_month --group-by metric_time__week --order metric_time__week
265+
mf query --metrics mrr_by_end_of_month --group-by subscription__subscription_date__month --order subscription__subscription_date__month
266+
mf query --metrics mrr_by_end_of_month --group-by subscription__subscription_date__week --order subscription__subscription_date__week
267267
```
268268

269269
import SetUpPages from '/snippets/_metrics-dependencies.md';

0 commit comments

Comments
 (0)