I am trying to fetch date-wise running total of member counts.
The relationships in data base are like this
(city:City) //has name property
-[:Has_Club]->
(c:Club) // has name property
-[:Has_Member]->
(p:Person{
name:"XYZ", //string
joinDate: date}) // in_datetime_format
So if the member count is as shown below I want to generate the running total
I wrote this query to use REDUCE function in neo4j. I only wanted the day column and running_total_column
match
(city:City{name:"city_name"})
-[:Has_Club]->
(club:Club{name:"clubName"})
-[:Has_Member]->
(p:Person)
with p.joinDate as jd, collect(count(*)) as dateColl
return distinct(date(jd)) as day, reduce(cons = 0, i in dateColl | i+ cons) as memberCount
But it gave the following error
Can't use aggregate functions inside of aggregate functions. (line 13, column 36 (offset: 401))
" with p.joinDate as jd, collect(count(*)) as dateColl"
What am I doing wrong? What do I need to change in my Query?