I have a table with 4 columns: timestamp, machine, created_date, deleted_date
An example of data would be:
timestamp machine created_date deleted_date
2018-04 A 2018-04 2018-06
2018-04 B 2018-04 null
2018-05 A 2018-04 2018-06
2018-05 B 2018-04 null
2018-05 C 2018-05 null
2018-05 D 2018-05 2018-07
2018-06 A 2018-04 2018-06
2018-06 B 2018-04 null
2018-06 C 2018-05 null
2018-06 D 2018-05 2018-07
2018-06 E 2018-06 null
2018-07 B 2018-04 null
2018-07 C 2018-05 null
2018-07 D 2018-05 2018-07
2018-07 E 2018-06 null
2018-07 F 2018-07 null
2018-07 G 2018-07 null
So every month I get a list of existing machines with the values of creation and deletion (once the machine is deleted, the records are updated for the deleted_date of the previous months).
What I’m trying to do is create a chart with the cumulative growth of number of machines per month.
I can’t simply do a count distinct machine because they repeat each month and I would be counting multiple times the same one on the cumulative chart.
In the example above I have
2018-04 > 2 created
2018-05 > 2 created
2018-06 > 1 created and 1 deleted
2018-07 > 2 created and 1 deleted
So my chart would have the values: 2 - 4 - 4 - 5
My question is: how to create a measure that will count by my timestamp how many machines were created minus how many were deleted on that month?
Thank you