dbt-labs / dbt-labs/dbt

[Feature] Populate `depends_on` for metrics within filters for the Semantic Layer

Open
#12,411 1 comment 0 reactions 0 assignees View on GitHub
engine:v1 semantic type:feature
Dominant language
Rust
Stars
13.8k
Forks
2.6k
Avg merge
21h 31m
Merged PRs (30d)
56

Description

### Is this a new bug in dbt-core?

- [x] I believe this is a new bug in dbt-core
- [x] I have searched the existing issues, and I could not find an existing issue for this bug

### Current Behavior

In the Semantic Layer, metrics that have a filter dependent on another metric are not included as part of the lineage graph.

Sample definition
```
- name: ns_push_and_in_app_messaging
description: ARR $ sending mobile push/in-app
type: derived
label: North Star for Push and In-App Messaging
type_params:
expr: sum_ending_arr
metrics:
- name: sum_ending_arr
filter: |
{{ Metric('sum_push_received', group_by=['klaviyo_account_id']) }} > 0
```

Rendered Lineage

Image

### Expected Behavior

The filtered metric should be part of the lineage

### Steps To Reproduce

1. Create metric with a filter using a different source metric
2. Run `dbt docs`

### Relevant log output

```shell
N/A
```

### Environment

```markdown
- OS: MacOS 26.2
- Python: 3.13.2
- dbt: 1.12.0-a1 (hatch)
- snowflake 1.11.1
```

### Which database adapter are you using with dbt?

snowflake

### Additional Context

PR to come!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.