on reflection I believe the 1st table in the above example is not relevent to this example.
added a very simple qlikview file with the inline statement done if it is useful for anyone
testCar.qvw 130.8 K
Attached is one possible solution.
The first step is to expand the events table into a row for every date in the interval. Henric;s blog post
describes this in detail. For this example, I used a QVC (http://qlikviewcomponents.org) routine to expand the table:
CALL Qvc.ExpandInterval('CarEvents', 'EffectiveDate', '', '[Car ID]');
The next step is to flag the month end dates in the table. I chose to create a new field for those rows that have a month end date:
Right JOIN (CarEvents)
LOAD Distinct *
,if(EffectiveDate = floor(MonthEnd(EffectiveDate)), date(EffectiveDate,'YYYY-MMM')) as MonthEnd
At this point, you could summarize the <>base [Car ID] count in the script. I chose to do the counting in the chart, anticipating that you may want to use additonal selectons like "Make=Toyota". The chart Dimension is the previously created "MonthEnd" field , the expression is:
The sum(0) bit is a trick to force inclusion of the months that have zero cars.
UsedCars_86272.qvw 180.8 K