Know Your Metrics

We can’t say anything without doing a deep-dive analysis.

Monthly Active CustomersTo see the details Monthly Active Customers, we will follow the steps we exactly did for Monthly Revenue.

Starting from this part, we will be focusing on UK data only (which has the most records).

We can get the monthly active customers by counting unique CustomerIDs.

Code snippet and the output are as follows:No.

of active customers per month and its bar plot:In April, Monthly Active Customer number dropped to 817 from 923 (-11.


We will see the same trend for number of orders as well.

Monthly Order CountWe will apply the same code by using Quantity field:Monthly order count and its bar plot:As we expected, Order Count is also declined in April (279k to 257k, -8%)We know that Active Customer Count directly affected Order Count decrease.

At the end, we should definitely check our Average Revenue per Order as well.

Average Revenue per OrderTo get this data, we need to calculate the average of revenue for each month:Monthly average revenue per order and its bar plot:Even the monthly order average dropped for April (16.

7 to 15.


We observed slow-down in every metric affecting our North Star.

We have looked at our major metrics.

Of course there are many more and it varies across industries.

Let’s continue investigating some other important metrics:New Customer Ratio: a good indicator of if we are losing our existing customers or unable to attract new onesRetention Rate: King of the metrics.

Indicates how many customers we retain over specific time window.

We will be showing examples for monthly retention rate and cohort based retention rate.

New Customer RatioFirst we should define what is a new customer.

In our dataset, we can assume a new customer is whoever did his/her first purchase in the time window we defined.

We will do it monthly for this example.

We will be using .

min() function to find our first purchase date for each customer and define new customers based on that.

The code below will apply this function and show us the revenue breakdown for each group monthly.

Dataframe output after merging with First Purchase Date:Revenue per month for New and Existing Customers:Line chart of the above:Existing customers are showing a positive trend and tell us that our customer base is growing but new customers have a slight negative trend.

Let’s have a better view by looking at the New Customer Ratio:New Customer Ratio has declined as expected (we assumed on Feb, all customers were New) and running around 20%.

Monthly Retention RateRetention rate should be monitored very closely because it indicates how sticky is your service and how well your product fits the market.

For making Monthly Retention Rate visualized, we need to calculate how many customers retained from previous month.

Monthly Retention Rate = Retained Customers From Prev.

Month/Active Customers TotalWe will be using crosstab() function of pandas which makes calculating Retention Rate super easy.

First, we create a dataframe that shows total monthly revenue for each customer:crosstab() function converts it to retention table:Retention table shows us which customers are active on each month (1 stands for active).

With the help of a simple for loop, for each month we calculate Retained Customer Count from previous month and Total Customer Count.

In the end, we have our Retention Rate dataframe & line chart like below:Monthly Retention Rate significantly jumped from June to August and went back to previous levels afterwards.

Cohort Based Retention RateThere is another way of measuring Retention Rate which allows you to see Retention Rate for each cohort.

Cohorts are determined as first purchase year-month of the customers.

We will be measuring what percentage of the customers retained after their first purchase in each month.

This view will help us to see how recent and old cohorts differ regarding retention rate and if recent changes in customer experience affected new customer’s retention or not.

This will be a bit more complicated than others in terms of coding.

Tx_retention has this amazing view of cohort based retention rate:We can see that first month retention rate became better recently (don’t take Dec ’11 into account) and in almost 1 year, only 7% of our customers retain with us.

Finally…We know our metrics and how to track/analyze them with Python.

You can find the jupyter notebook of this article here.

Let’s try to segment our base to see who are our best customers in Part 2.

.. More details

Leave a Reply