Hi everyone,
I've got a bunch of data with which I want to create a moving average visualization over time.
I'd like the time span for the calculation of the moving average to be the last 2 days, and the time span of my line chart to be 1 or 2 months.
The trick is that I receive data that can appear several times. For instance, this is what I can receive:
[
{"changeId":"18864", "timestamp": "2018-10-19 10:00:00", "total": 5 },
{"changeId":"18865", "timestamp": "2018-10-19 10:00:00", "total": 10 },
{"changeId":"18866", "timestamp": "2018-10-19 10:00:00", "total": 15 },
{"changeId":"18864", "timestamp": "2018-10-20 10:00:00", "total": 5 },
{"changeId":"18865", "timestamp": "2018-10-20 10:00:00", "total": 10 },
{"changeId":"18866", "timestamp": "2018-10-20 10:00:00", "total": 15 },
{"changeId":"18867", "timestamp": "2018-10-20 10:00:00", "total": 20 },
{"changeId":"18865", "timestamp": "2018-10-21 10:00:00", "total": 10 },
{"changeId":"18866", "timestamp": "2018-10-21 10:00:00", "total": 15 },
{"changeId":"18867", "timestamp": "2018-10-21 10:00:00", "total": 20 },
{"changeId":"18868", "timestamp": "2018-10-21 10:00:00", "total": 25 },
{"changeId":"18865", "timestamp": "2018-10-22 10:00:00", "total": 10 },
{"changeId":"18866", "timestamp": "2018-10-22 10:00:00", "total": 15 },
{"changeId":"18867", "timestamp": "2018-10-22 10:00:00", "total": 20 },
{"changeId":"18868", "timestamp": "2018-10-22 10:00:00", "total": 25 },
{"changeId":"18869", "timestamp": "2018-10-22 10:00:00", "total": 30 },
{"changeId":"18869", "timestamp": "2018-10-23 10:00:00", "total": 35 }
]
So in this case, I want the total field where changeId = 18864 to be counted only once (the most recent value). Is it even possible ? I've tried many things but I can't find any solutions...