Skip to content

Commit

Permalink
Update measures.md
Browse files Browse the repository at this point in the history
active voice and fix typos
  • Loading branch information
mirnawong1 authored Jul 19, 2023
1 parent 8919e39 commit 7c148bf
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions website/docs/docs/build/measures.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,27 @@ Measures are aggregations performed on columns in your model. They can be used a
| [`agg`](#aggregation) | dbt supports the following aggregations: `sum`, `max`, `min`, `count_distinct`, and `sum_boolean`. | Required |
| [`expr`](#expr) | You can either reference an existing column in the table or use a SQL expression to create or derive a new one. | Optional |
| [`non_additive_dimension`](#non-additive-dimensions) | Non-additive dimensions can be specified for measures that cannot be aggregated over certain dimensions, such as bank account balances, to avoid producing incorrect results. | Optional |
|[agg_params]| specific aggregation properties such as a percentile. | [Optional]|
|[agg_time_dimension]| The time field. Defaults to the default agg time dimension for the semantic model. | [Optional] |
|[non_additive_dimension]| configs used if needing non-additive dimensions | [Optional]|
|[label]| How the metric will be displayed in docs and downstream integrations. | [Required]|
| [`agg_params`] | specific aggregation properties such as a percentile. | [Optional]|
| [`agg_time_dimension`] | The time field. Defaults to the default agg time dimension for the semantic model. | [Optional] |
| [`non_additive_dimension`] | Use these configs when you need non-additive dimensions. | [Optional]|
| [`label`] | How the metric appears in project docs and downstream integrations. | [Required]|


## Measyres Spec
An example of the complete yaml measures spec is below. The actual configuration of your measures will depend on the aggregation you're using.
## Measure spec

```
An example of the complete YAML measures spec is below. The actual configuration of your measures will depend on the aggregation you're using.

```bash
measures:
- name: The name of the measure # think transaction_total. If `expr` not present then this is the expected name of the column [Required]
- name: The name of the measure # think transaction_total. If `expr` isn't present then this is the expected name of the column [Required]
description: same as always [Optional]
agg: the aggregation type. #think average, sum, max, min, etc.[Required]
expr: the field # think transaction_total or some other name you might want to alias [Optional]
agg_params: specific aggregation properties such as a percentile [Optional]
agg_time_dimension: The time field. Defaults to the default agg time dimension for the semantic model. [Optional]
non_additive_dimension: configs used if needing non-additive dimensions [Optional]
label: How the metric will be displayed in docs and downstream integrations. [Required]
`
non_additive_dimension: Use these configs when you need non-additive dimensions. [Optional]
label: How the metric appears in project docs and downstream integrations. [Required]
```

### Name

Expand Down Expand Up @@ -82,7 +83,7 @@ If you use the `dayofweek` function in the `expr` parameter with the legacy Snow
```yaml
semantic_models:
- name: transactions
description: A record for every transaction that takes place. Carts are considered multiple transactions for each SKU.
description: A record of every transaction that takes place. Carts are considered multiple transactions for each SKU.
model: ref('schema.transactions')
defaults:
agg_time_dimensions:
Expand Down Expand Up @@ -210,14 +211,14 @@ semantic_models:
name: metric_time
window_choice: min
- name: mrr_end_of_month
description: Aggregate by summing all users active subscription plans at end of month
description: Aggregate by summing all users' active subscription plans at the end of month
expr: subscription_value
agg: sum
non_additive_dimension:
name: metric_time
window_choice: max
- name: mrr_by_user_end_of_month
description: Group by user_id to achieve each users MRR at the end of the month
description: Group by user_id to achieve each user's MRR at the end of the month
expr: subscription_value
agg: sum
non_additive_dimension:
Expand Down

0 comments on commit 7c148bf

Please sign in to comment.