Hi all,
I am trying to do a line chart that shows the average number of people at each hour of the day in a store.
The values that I have to average are repeated multiple times for each hour and are different for each area of the store. For example:
timestamp area #people
yyyy-mm-01 12:00:00 Bar 3
yyyy-mm-01 12:00:00 Bar 3
yyyy-mm-01 12:00:00 Restaurant 5
yyyy-mm-01 12:00:00 Back 4
yyyy-mm-01 12:00:00 Back 4
yyyy-mm-02 12:00:00 Bar 10
yyyy-mm-02 12:00:00 Bar 10
yyyy-mm-02 12:00:00 Restaurant 20
yyyy-mm-02 12:00:00 Back 8
yyyy-mm-02 12:00:00 Back 8
I would like a line chart that for the value hour = 12 gives me the average number of people in total [(3+5+4)+(10+20+8)]/2. And to still give the possibility to drill down in each area and get:
for Bar the value (3+10)/2
for Restautant the value (5+20)/2
for Back the value (4+8)/2
I thought of using this approach:
max value grouping by timestamp and area
sum the values grouping by timestamp
calculate the average.
Thank you!
This allows me to have the sum along the days, is there any way to have the average of that sum? In the case of the example I would need to divide by 2 (distinct number of timestamps)
Are you looking for the average amount of people at the establishment for every hour of the day, where we are calculating the average by looking at how many people are there at that hour for every day in your data set?
If so then this formula should work, by summing the max amount of people at each area for every day, and then dividing by the number of days (distinct_count of timestamp).
If this is not what you are intending to do, can you describe what the x_axis will be on the visual, and why the formula I posted above is not returning what you would expect?