
Coalesce
Use a Coalesce node test to catch duplicate subscription rows before reporting recurring revenue.
- Staging
- A subscription can have several billing contacts.
- Reporting node
- The model promises one active row per subscription.
- Node test
- A grouped query returns keys with more than one row.
Test the grain after a new join
The billing report’s active-subscription node has one row per subscription. A new join pulls billing contact data and the warehouse now shows two rows for subscription SUB-84. In Coalesce, add a node test that selects subscription_id and groups by it, with HAVING COUNT(*) > 1. Point the query at the node using the project’s storage mapping and the documented node reference helper. Coalesce marks the test failed when the query returns rows.
Run the node in an isolated environment and inspect Results. Add a separate null-key check because a single null key survives a duplicate check. If the new relationship legitimately has multiple contacts, either filter to the one contact selected for billing or move contact details into a related model that preserves the subscription grain.
| Input fixture | Expected result |
|---|---|
| SUB-84 appears once at $900 MRR | The duplicate query returns zero rows and MRR is $900. |
| SUB-84 appears twice after a join | The node test returns SUB-84 with a count of two. |
| One subscription ID is NULL | The separate null-key test catches the row. |
Capture the expected row grain and the field that identifies it in the data model.