Rolling Sums in Metabase


I’m trying to figure out a way to have a rolling sum in metabase (sum of customers, by date, over time), but it doesnt seem to support window claueses (partitioning). Does anyone have any experience doing this with Metabase?



Hi Jarry,
I might not understand your question right - what are you trying to do exactly? With the SQL editor you are able to do flexible dates like
And str_to_date(concat(date_format(table.created_At, ‘%Y-%m’), ‘-01’), ‘%Y-%m-%d’) BETWEEN str_to_date(concat(date_format(date_add(now(), INTERVAL -12 month), ‘%Y-%m’), ‘-01’), ‘%Y-%m-%d’)
AND str_to_date(concat(date_format(date_add(now(), INTERVAL -1 month), ‘%Y-%m’), ‘-01’), ‘%Y-%m-%d’)

what gives you always (as an example) the last 12 months rolling.
So if you then group by it as well you get the data per month for the last 12 months.

Do you mean something different? I did quite some queries with rolling dates by now so hope I can help you!
Cheers, Eva