Is it possible to calculate some metrics (count, sum) for a specific time period like Today/This Week/This Month/Last Month in Cube.js. Is rollingWindow what I need? I tried it but it doesn't return me right data. Documentation is a bit confusing for me.
To be more descriptive I will use Orders table as an example.
I have simple Orders table in which I have product_id, product_name, created_at columns. On frontend i need to create analitycs table in which I will have product_name, this week (orders that are created this week for a specific product), this month (orders that are created this month for a specific product) and total orders by product.
Is there a way to do it like this:
measures: {
thisWeek: {
sql: 'id',
type: 'count',
filters: [{ sql: `${CUBE}.created_at = 'This week'` }],
},
}