
Explanation:
Operation
Correct Location
Aggregations (booked_hotel, booked_ride)
In a model dedicated to pre-aggregate data for reporting
Standardizing customer_id
In the first layer of models
Selecting customer_name
In the first layer of models
Joining employees
In a model between the first layer and final layer of models
In dbt's recommended modeling framework, transformations should be centralized according to their purpose and level of abstraction. Basic cleaning and column standardization-such as shortening customers.id using left(customers.id, 12)-belongs in the first layer of models, commonly known as staging models. This layer is responsible for producing clean, consistent, analytics-ready fields. Selecting raw descriptive fields like customers.name also belongs in this layer.
Joins that enrich a dataset by combining cleaned staging outputs across domains-such as joining customers with employees-belong in intermediate models. These models unify business logic that sits between the raw staging layer and the final aggregations used for reporting.
Finally, aggregations like counting types of accommodations (booked_hotel and booked_ride) belong in marts or reporting models, especially when they involve summarization that downstream tools (dashboards, BI reports) will consume. This keeps heavy business logic centralized and reusable.