Question

Dynamic Cohorts

  • 29 April 2021
  • 1 reply
  • 30 views

Hello,

Our team is currently working on several requests that involve the ability to create custom cohorts. Here are some examples of cohort related problems we’re working on:

  1. If customer bought x product in time frame A, what products did they buy in time frame B (time frame b can be in the future or in the past)
  2. Flow of products purchased from first order, to second order, to third order.

I created a derived table for cohorts based off of information from the Looker Community such as:

 

Using the info from these articles I was able to create a cohort based on their purchase date if the comparison date range is always the same. For example, if the user selects date range A when the product purchase was made, the comparison date range is a static 2 previous years. This works, but we are trying to gain the capability of making these cohorts dynamic for our end users instead of creating custom work for them each time we get a request. 

Any help or guidance would be greatly appreciated!

Thanks


1 reply

Do you have any experience using liquid for dates? Without seeing your LookML/SQL that would be my first approach. Then you could label the filters as timeframe A and timeframe B.

 

You also can decide where to use the liquid based on performance; if this is a small table that you do not mind rebuilding frequently, I would suggest the liquid embedded inside the derived table. If larger, I would try working within dimensions/measures.

Reply