Okay, here we are for our very last tutorial on customer lifetime value. I going to rerun all the codes from module four that are up to the point we left it, which is around line 109. Here we are. That's where we were. And now we're going to use these predictions we've just made to compute the value of the database. How do we do that? Well, we need to assign a revenue to each segment. And we're not going to compute it again, we've done it already. If you look at the Module 2 code on lines 160 and 161, that's where we got these figures. Customers were inactive, cold, warm, by definition and generate no revenue at all. The active high value customers on average generate $323 of revenue per year. And then for the active low value and new active, it goes down to 52 and 79. So we're going to just steal the data from that analysis and store it, in a variable called yearly revenue. The next step is simply to take the variable called segments, which contains predictions of segment membership over the next 11 years. And multiply the segment membership by how much revenue revenue each segment generates, which is exactly what we've inputted here. And so if you print it, as you can see here the active high value customers will generate, actually have generated in 2015, $185,000. Then the number of customers in that segment we increase, decrease, stabilize, and every time for every customer in that segment they will generate $323. And you see the values here going up and down as a function of predictions. The next thing we'd like to do, because that's segment per segment, year by year. What we'd like to do is to compute the sum of each column. So we have the yearly revenue of the database for that year. We are going to use the function call sum. So we're going to sum each column to itself of the revenue per segment variable we just create and store the output as a new variable called yearly revenue. That's what we do, we print it, and so in terms of revenue predictions, without any discount we've generated $478,000 in 2015. And because people will become slowly inactive over time by the year 2025 we'll have only $307,000 in revenue. So, it will slowly decrease over time as you can see here. And you can create a bar plot of revenue prediction going pretty high in 2015 and then, decreasing quite quickly up to 2025, which is the last year we made predictions for. If you'd like to compute the cumulative revenue. So how much money will we have made in 2025 correlated over 2015, 16, 17, 18, and so on and so forth. You can compute that using what is called the cum sum, cumulative sum of yearly revenue. You compute it, print it, and that's how much revenue will have been generated over the years. And as you can see of course, it can only increase since every area you add new revenue to that. But you probably see that the slope of the curve is slowly deteriorating because every year a different customer hence we lose a different revenue. But a dollar ten years from now is not worth a dollar to them. It needs to be discounted. I'm going to set the discount rate at 10% and compute the discount rate for years one to 11. So basically from year 2015 to 2025, knowing that for 2015 the discount rate cannot be applied since it's today. So I remove one year here as if it were immediately now. And the function is 1 / ((1 + discount_rate) to the power of how many years you need to wait to get the money. And, as you can see. In the first year you're not going to discount anything. That's today, today's money worth in today's dollars. Then after a year, a dollar would be worth $0.90. Then only $0.82 75 and so on. And as you can see, after 10 years it will only be worth $0.38. How am I going to use that information? Well, simply by taking all the values I've generated so far. Such as the yearly revenue, and multiply these figures by the discount rate to get something that is worth $2,000. That's how much money in two days worth is gonna be generated in 2008, 19, and so on. And so by the year 2025 we generate the equivalent of what would be worse to the $118,000 for two reasons. Number one, it's in ten years, so it needs to be discounted. Number two, it's in ten years. Meaning many customers will have left and will not be active anymore. And if I plot that here, here you have the undiscounted revenue generated of the years. And here you have the discounted ones. As you can see it, drops dramatically. Since the further away in the future you get the revenue, the less worth it is in today's dollars. In terms of cumulative revenue, exactly the same thing. You take the yearly revenue discounted and compute the sum, and you get every everything we've had already, except it's now represented in discounted revenue. The last question we could ask is, off the next ten years, how much is my database worth? What's the true value, the discounted cumulative value of my database in terms of expected revenue of the next ten years. What you can do is to look at how much it would be worth accumulated at the end of the period you are analyzing, in this case the 11th period. That would be 225, of which you remove the revenue from to date, 2015, which already happened. And if you run and print that, the answer is 2,150,000. So, if you had to value your database in today's dollars in terms of how much revenue it will generate over the next ten years, the answer is $2.15 million.