# Estimating average count based on day

Hello,

Using flux in influxdb, I would like to estimate the average number of people at the gym based on previous history on Monday-Sunday. I am using home assistant and my local gym has the number of people currently at the gym and I am constantly pulling data from that. So what I would like to do is for each day of the week, use the corresponding collected data and calculate a moving average of some sort that corresponds with their operating hours. Lets take Monday for example. I would like to filter out all data except for Monday, then filter out all times they are not open (they are open from 5am-10pm) then I would like to use the data I have collected and calculate the average number of people every 10 minutes so I can see a line graph of when it is most busy/ least busy. Then I would like to repeat this for every day of the week. Fridays, Saturdays, and Sundays all have different hours so I may have to do it in separate graphs. Google does something similar to this as an example.

Also, I found a thread kind of like what i need but it did not produce exactly what I wanted…
Average per hour - #14 by MarioG (the comment by mariog)
Is this possible? I have been trying to figure this out for the past few days with no success. Thanks!

I hope someone else here can provide you with a helpful answer, but at first
glance my feeling is that InfluxDB is not the best tool for this job.

InfluxDB is a data store, and although the Flux query language has a variety of
useful operators and manipulation functions, I think it’s all a bit too “low
level” for the type of statistical analysis and future prediction you’re
trying to do.

Also, InfluxDB is a time-series database, meaning that it’s best suited for
queries where you want to retrieve a series of data points based on timestamp.
Picking out “all the values for Tuesdays 10:00-11:00” doesn’t really fit with
that, because InfluxDB has no concept of a Tuesday (or a generic 10:00 for that
matter). InfluxDB only knows that 1641895200 is today at 10:00 (UTC), and
seven days ago, or seven days into the future, is meaningless to Influx.

Regards,

Antony.

Okay, thank you!

I will keep looking for a solution.

John