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
Copy file name to clipboardExpand all lines: references/metrics.mdx
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1060,6 +1060,12 @@ models:
1060
1060
- web_sessions.session_id # field from joined table
1061
1061
```
1062
1062
1063
+
### Default show underlying values
1064
+
1065
+
You can set a default `show_underlying_values` configuration at the model level using `default_show_underlying_values`. This applies to all metrics in that model, and individual metrics can override it by specifying their own `show_underlying_values`.
1066
+
1067
+
See [default_show_underlying_values in the Tables reference](/references/tables#default-show-underlying-values) for full details and examples.
1068
+
1063
1069
The list of fields must be made of dimension names (or metrics if you'd like to include them) from the base table or from any joined tables. To reference a field from a joined table, you just need to prefix the field name with the joined table name, like this: `my_joined_table_name.my_dimension`.
1064
1070
1065
1071
The order that the fields are listed in `show_underlying_values` is the order that they'll appear in on the `view underlying data` table.
Copy file name to clipboardExpand all lines: references/tables.mdx
+30Lines changed: 30 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -74,6 +74,7 @@ models:
74
74
| [required_attributes](#required-attributes) | object | Limits access to users with those attributes. [Read about user attributes](/references/workspace/user-attributes) |
75
75
| group_details | object | Describes the groups for dimensions and metrics |
76
76
| [default_filters](#default-filters) | array | Dimension filters that will be applied when no other filter on those dimension exists. [`Read about default_filters`](#default-filters) |
77
+
| [default_show_underlying_values](#default-show-underlying-values) | array | Default fields shown in "View underlying data" for all metrics in this model. [Read about default_show_underlying_values](#default-show-underlying-values) |
77
78
| [explores](#explores) | object | Allows you to define multiple table explores in Lightdash from a single dbt model. |
78
79
| [parameters](#parameters-configuration) | object | Model-level parameters that can be referenced in SQL properties. [Read about parameters](#parameters-configuration) |
79
80
| [sets](#sets) | object | Allows you to define a reference to a collection of fields. This reference can be re-used throughout the model. |
@@ -247,6 +248,35 @@ models:
247
248
Using a properly defined primary key helps Lightdash optimize queries and provide accurate results when working with joined tables. It's especially important for preventing metric inflation in SQL joins where duplicate rows can lead to incorrect aggregations.
248
249
249
250
251
+
## Default show underlying values
252
+
253
+
You can set a default `show_underlying_values` configuration at the model level that applies to all metrics in that model. This is useful when you want consistent underlying data visibility across all metrics without repeating the same configuration for each metric.
254
+
255
+
Individual metrics can override the model-level default by specifying their own `show_underlying_values`.
256
+
257
+
```yaml
258
+
models:
259
+
- name: payments
260
+
meta:
261
+
default_show_underlying_values:
262
+
- orders.customer_id
263
+
- unique_payment_count
264
+
metrics:
265
+
total_revenue:
266
+
type: sum
267
+
sql: ${TABLE}.revenue
268
+
# Uses the model default: orders.customer_id, unique_payment_count
269
+
average_revenue:
270
+
type: average
271
+
sql: ${TABLE}.revenue
272
+
show_underlying_values:
273
+
- custom_field # Overrides the model default
274
+
```
275
+
276
+
The list of fields must be dimension names (or metrics if you'd like to include them) from the base table or from any joined tables. To reference a field from a joined table, prefix the field name with the joined table name, like this: `my_joined_table_name.my_dimension`.
277
+
278
+
The order that the fields are listed in `default_show_underlying_values` is the order that they'll appear in on the "View underlying data" table.
279
+
250
280
## Default filters
251
281
252
282
Use `default_filters` to define filters on Dimensions that will be applied when no other user-defined filter on those Dimensions exists. Default filters will show apply to tables on load and can be populated with a pre-determined value. User them to suggest to users the kind of filters they might want to consider, or provide a default filtered view of a table that can be changed if needed.
0 commit comments