How to create measures in dimensional tables without time dimensions

Hi!

How can I create measures in dimensional tables without time dimensions?
It seems that having a primary time dimension is a requirement from metricflow when creating a data source with measures.

However, I would like to have cases like this:

yaml
semantic_models:
  - name: customers
    model: {{ ref('customers') }}
    entities:
      - name: customer_id
        type: categorical
        expr: customer_id
    measures:
      - name: total_distinct_customers
        expr: customer_id
        type: count_distinct

How can i do it? Imagine the customers table only have those 2 columns.

Hi @pedromnasc !

I ran across your question when trying to solve a similar problem in my own models this morning.
I solved this by creating a “proxy” time dimension using current_date

    dimensions:
      - name: measure_time
        expr: 'current_date'
        type: time
        type_params:
          time_granularity: day 

Note: I am running dbt against a Redshift instance. If using other SQL dialects, replace the current_date expression with the corresponding SQL function of your environment

The idea is that in cases like this -for customer dimensions, or other descriptive entities- measures associated are often attempting to get counts, or other simple aggregations, irrespective of time; in other words, the current state of the data. So, even though the current date is arbitrary as far as our data is concerned, it serves a function that can be rationalized

I hope this helps!