Date filter syntax & sum measure to provide recent {n} {interval}

Paraphrased data model: I’ve got an `accounts` table which `has_many` snapshots.

Each snapshot has:

  • account_id
  • month (date of start of the month)
  • percent_used
  • percent_used_delta (this month % used - last month % used)

I’m trying to create a way to look at, by account, the change % used over different period of time, excluding the incomplete current interval.

This means, somewhere, I should have:

`3 months ago for 3 months` , somewhere.

Two ways to proceed I can think of...

  1. sum up the percent_used_delta across the timeframe (excluding start_of_timeframe.month), or
  2. do (end_of_timeframe.percent_used - start_of_timeframe.percent_used)

Where I’m having troubles is understanding syntactically how to set up the date filter and measures for this situation. Initially, just having months would be good. I’m assuming this should be a relationship between dimension/date filter/measure in my view. Or something else?

That’s what I think I’m trying to accomplish. I’m not currently sure syntactically how to do it.

As a followup, it would be nice to be able to provide specific interval presets (1 month, 3 month, 6 month, 12 months, quarters, etc).

0 0 184
0 REPLIES 0
Top Labels in this Space
Top Solution Authors