One model file - multiple tables (metrics / active aggregation)


I had a look at dbt Metrics recently and even though it’s a great move forward, I find myself still not being able to fulfill my requirements.

When it comes to timeframe metrics (or as I call it active aggregation) that cound unique ids or sums values for unique ids in a specific timeframe, I want to be able to to query it from outside of dbt (BI Tool).

Right now I use a dynamic SQL in Looker to build the SQL on the fly depending on whether somebody chooses day/wek/month and so on. Those tables are cached but the upside is that I have one code = 5 tables. Of course ideally I would like to move the code outside of Looker to dbt but I wouldn’t want to keep the same code in 5 files with one dimension changed.

Has anybody tried to solve such problem?

1 Like