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

**URL:** <https://discourse.getdbt.com/t/one-model-file-multiple-tables-metrics-active-aggregation/5856>\
**Category:** In-Depth Discussions\
**Created:** [December 29, 2022, 10:21am UTC](https://discourse.getdbt.com/t/one-model-file-multiple-tables-metrics-active-aggregation/5856 "2022-12-29T10:21:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![moseleyi](https://avatars.discourse-cdn.com/v4/letter/m/edb3f5/32.png) [@moseleyi](https://discourse.getdbt.com/u/moseleyi)\
**Post date:** [December 29, 2022, 10:21am UTC](https://discourse.getdbt.com/t/one-model-file-multiple-tables-metrics-active-aggregation/5856/1 "2022-12-29T10:21:29Z")

</div>

Hi,

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?
