Home:ALL Converter>Retention Tracking

Retention Tracking

Ask Time:2012-09-21T20:44:35         Author:TR7

Json Formatter

Let’s say I have an Angry Birds game.

I want to know how many players are buying the ‘mighty eagle’ weapon each month out of the players which bought the mighty eagle weapon in the previous months in their LTV in the system

I have the dates of all items bought per each client.

What I practically would like to have is a two dimensional matrix that will tell me what the percentage of the players which moved from LTV_month_X to LTV_month_Y for each combination of X<Y for a specific current month?

An example:

example_png (it didn't let me to put the pic inline so please press the link to see the pic)

Now, I have found a way to get the number of players moved actually from from LTV_month_X to LTV_month_Y that LTV_month_Y is their current month of activity within the system using SQL query and Excel Pivot table.

What I try find out is mainly is how to get the base number of those who potentially could do that transition.

A few definitions: LTV_month_X = DATEDIFF(MONTH, first_eagle_month, specific_eagle_month)+1

Preferably I would like to have the solutions in ANSI-SQL, if not then MySQL or MSSQL but no Oracle functions should be used at all.

Since I’m looking for the percentage of the transition two-steps plans could also work, first find the potential ones and the find the actual ones who moved to measure the retention from  LTV_month_X to LTV_month_Y.

One last issue: I need for it to be possible to drill down and find the actual IDs of the clients who moved from any stage X to any other stage Y (>X).

Author:TR7,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/12530875/retention-tracking
Shahar :

The use of the term LTV here is not clear. I assume you mean the lifetime of the user.\n\nIf I understand the question, you are asking, based on a list of entities each with one or more events, how do I group (e.g. count) the entities by the month of the last event and the month of the one before last event.\n\nin mysql, you can use a variable to do that. I'm not going to expalin the whole concept, but basically, when within a SELECT statement you write @var:=column, then that variable is assigned the value of that column, and you can use that to compare values between consectuive columns e.g. \nLEAST(IF(@var=column,@same:=@same+1,@same:=0),@var:=column)\n\nthe use of LEAST is a trick to ensure execution order.",