keen-io Multi-Analyse with difference timeframe

146 views Asked by At

I need your help.

I'm using KeenIO and SDK Ruby

  1. Can I run in single query multiple types of analyses for different time frame? something like Multi-Analysis, but in each analyse set time frame.

for example:

Keen.multi_analysis(:users, analyses: { week: { analysis_type: 'count', timeframe: 'this_7_days' }, { month: { analysis_type: 'count', timeframe: 'this_30_days' } })

  1. Same as in 1 but for difference tables.

P.S. Maybe I can do it via JavaScript?

Thx!

1

There are 1 answers

0
Kevin Litwack On

Per the Keen IO API documentation, "Multi-analysis lets you run multiple types of analyses over the same data." In other words a single multi-analysis query must be over the same collection/timeframe/filters. If you want to query different timeframes or collections, you need to execute multiple queries.

As additional technical background: a multi-analysis query can be executed more efficiently than running its component parts independently, because on the back end the events are read from the database once and all of the computations are performed in a single pass. If the component parts were over different data then there would be no performance benefit.

(I work as a platform engineer at Keen - hope that explanation helped!)