I have one table that stores all records of when customers started with the company and when they left (or if they are still an active customer they will have a leave date of 30/12/1899). What I want to do is create a weekly table that shows the number of active customers (by Area) and then compare to the previous week (and previous week last year) to view trends of what customers leave and join. The dataset is very much based on the below table so I'm struggling to create a structure that will handle this request. Using the below as an example I would want w/c 08/07/2013 to show that I had 4 active customers (Customer A, Customer B, Customer C and Customer D)
that is pretty easy. You could find plenty of articles on how to "create missing data". However, I have done the same with personell data - from a start_date and an end_date, I created a table with one record per day.
are you serious in saying that the currently active customers have a leaveDate in the far past?
Well, I guess you are since you have said it twice now.
No, of course not - if this is a standard date for all customers who are still active, you can just edit that IF-clause in the LOAD statement like
>>> IF(LeaveDate = '30/12/1899', TODAY(), LeaveDate) as EndDate <<<
That way, the table will be populated up to the present day for all customers who have this standardized LeaveDate (and are thus still active) and up to the LeaveDate for all others (who have already left).