Forum Discussion
Lamao
8 years agoFrequent Visitor
Count items between two dates (stored as status)
Hello, I have list of facilities which has been active during only some periods - the format (sample) of table is: FacilityID DateFrom Status 123 2017-10-01 0 123 2017-01-01 1...
Lamao
8 years agoFrequent Visitor
Hello,
I have list of facilities which has been active during only some periods - the format (sample) of table is:
| FacilityID | DateFrom | Status |
| 123 | 2017-10-01 | 0 |
| 123 | 2017-01-01 | 1 |
| 123 | 2018-02-01 | 0 |
| 123 | 2018-01-01 | 1 |
What I would like to achieve is:
| Period | Count of active facilities |
| 2017-01 | 1 |
| 2017-02 | 1 |
| 2017-03 | 1 |
| 2017-04 | 1 |
| 2017-05 | 1 |
| 2017-06 | 1 |
| 2017-07 | 1 |
| 2017-08 | 1 |
| 2017-09 | 1 |
| 2017-10 | 0 |
| 2017-11 | 0 |
| 2017-12 | 0 |
| 2018-01 | 1 |
| 2018-02 | 0 |
Thank you for any ideas / tips how to achieve this!