Metric with date_trunc or similar

A simple metric would be a sales column with valid values.
Another would be weekly sales, wich in postgresql would be date_trunc(‘week’,sales).
Or another, monthly sales, etc.

Example of data_trunc usage:
select sum(sales),date_trunc( ‘month’, time_stamp ) from salestable group by
date_trunc( ‘month’, time_stamp );

Is it possible to create this kind of metric? Or using sql maybe?

You can definitely do this via SQL.

You can also do this through the query builder by grouping on a date field and clicking on the arrow for more options, see the screenshot below

How did I miss that… just impressive!

1 Like