'Neo4j statistical data - average of count
I have 2 nodes p:Person and d:DateTime. I need to make statistics : for each hour of the week Monday 0: Monday 1: ... Monday 23: Tuesday 0: etc...
Total count is easy
MATCH (p:Person)-[dt:DATE]-(d:DateTime) RETURN d.datetime.dayOfWeek, d.datetime.hour, COUNT(p);
This will output for each hour of week total count, but i need to make average
ex. 10.1.2022 - Monday hour 0 - total count 5000 17.1.2022 - Monday hour 0 - total count 1000 OUTPUT: Monday 0: 3000;
Solution 1:[1]
If I understand correctly, you want something like:
MATCH (:Person)-[:DATE]-(d:DateTime)
WITH d, d.datetime.dayOfWeek AS day, d.datetime.hour AS hour, COUNT(p) AS count
RETURN day, hour, avg(count) AS average
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Tomaž BrataniÄ |
