Skip to content

Commit dac74e2

Browse files
Add documentation for default_show_underlying_values model property (#362)
* Update references/metrics.mdx Co-Authored-By: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com> * Update references/tables.mdx Co-Authored-By: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com> * Update references/tables.mdx Co-Authored-By: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com> * Update references/metrics.mdx Co-Authored-By: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com> --------- Co-authored-by: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com>
1 parent f982f57 commit dac74e2

2 files changed

Lines changed: 36 additions & 0 deletions

File tree

references/metrics.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,6 +1060,12 @@ models:
10601060
- web_sessions.session_id # field from joined table
10611061
```
10621062

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+
10631069
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`.
10641070

10651071
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.

references/tables.mdx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ models:
7474
| [required_attributes](#required-attributes) | object | Limits access to users with those attributes. [Read about user attributes](/references/workspace/user-attributes) |
7575
| group_details | object | Describes the groups for dimensions and metrics |
7676
| [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) |
7778
| [explores](#explores) | object | Allows you to define multiple table explores in Lightdash from a single dbt model. |
7879
| [parameters](#parameters-configuration) | object | Model-level parameters that can be referenced in SQL properties. [Read about parameters](#parameters-configuration) |
7980
| [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:
247248
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.
248249

249250

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+
250280
## Default filters
251281

252282
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

Comments
 (0)