How to count number of timestamp entries per day - count

what formula could I use to show the average number of timestamp entries per day? I use a Google Form that enters data into a Google Sheet. I want to eventually create Charts showing the average number of timestamps per day/week/month, with trends. (For example, we receive 5 telephone calls per day on average). I'm thinking I first need a formula to count the number of timestamp entries per day, then I can use another formula to find the average per day/week/month, etc.
Below is an example of the timestamp entries all in Column A now showing only the date as I removed the "time" using =ArrayFormula(Responses!A:A)
8/8/2016
8/8/2016
8/9/2016
8/9/2016
8/9/2016
8/9/2016
8/9/2016
8/10/2016
8/10/2016
8/10/2016
8/10/2016
8/10/2016
8/10/2016
8/10/2016
8/10/2016
8/10/2016
8/10/2016
8/10/2016
8/11/2016
8/11/2016

You can do the average per day using built-in Google Sheets formulae:-
Count(A2:A100)/CountUnique(A2:A100)
if the time stamps are in column A.
You could do the average of all of them per week just by taking the difference between the last and the first and dividing by 7:-
=COUNT(A2:A100)/((index(A2:A100,count(A2:A100))-A2+1)/7)
and you could do a similar thing for months (a bit more difficult because of the variable length of each month).
But I think if you are going to do trend lines, you want to get the unique days, weeks and months as you suggest and then do the counts.
So it's just
unique(a2:a100)
in (say) column B to get the separate days
=unique(filter(A2:A100,weekday(A2:A100)=2))
in (say) column D to get the beginning of each separate week and
=unique(filter(A2:A100,day(A2:A100)=1))
in (say) column F to get the beginning of each month.
Then you could set up countifs to count them:-
=countif(A2:A100,B2)
in C2
=countifs(A2:A100,">="&D2,A2:A100,"<"&(D2+7))
in E2
=countifs(A2:A100,">="&F2,A2:A100,"<="&eomonth(F2,0))
in G2
If your days contained still contained different times, would need to use int function to convert to 0:00 midnight, then would need to update above formulae to refer to column B:-

Using the Query function seems like the most direct solution? I just needed to display the total number of submissions from each day.
=Query('Form responses 1'!A1:A,"select YEAR(A), MONTH(A)+1,DAY(A), COUNT(A) where A is not null group by YEAR(A), MONTH(A)+1,DAY(A) label YEAR(A) 'Year',MONTH(A)+1 'Month', DAY(A) 'Day',Count(A) 'Num studs'", true)

Related

How to I transform half-hourly data that does not span the whole day to a Time Series in R?

This is my first question on stackoverflow, sorry if the question is poorly put.
I am currently developing a project where I predict how much a person drinks each day. I currently have data that looks like this:
The menge column represents how much water a person has actually drunk in 30 minutes (So first value represents amount from 8:00 till before 8:30 etc..). This is a 1 day sample from 3 months of data. The day starts at 8 AM and ends at 8 PM.
I am trying to forecast the Time Series for each day. For example, given the first one or two time steps, we would predict the whole day and then we know how much in total the person has drunk until 8 PM.
I am trying to model this data as a Time Series object in R (Google Colab), in order to use Croston's Method for the forecasting. Using the ts() function, what should I set the frequency to knowing that:
The data is half-hourly
The data is from 8:00 till 20:00 each day (Does not span the whole day)
Would I need to make the data span the whole day by adding 0 values? Are there maybe better approaches for this? Thank you in advance.
When using the ts() function, the frequency is used to define the number of (usually regularly spaced) observations within a given time period. For your example, your observations are every 30 minutes between 8AM and 8PM, and your time period is 1 day. The time period of 1 day assumes that the patterns over each day is of most interest here, you could also use 1 week here.
So within each day of your data (8AM-8PM) you have 24 observations (24 half hours). So a suitable frequency for this data would be 24.
You can also pad the data with 0 values, however this isn't necessary and would complicate the model. If you padded the data so that it has observations for all half-hours of the day, the frequency would then be 48.

Netsuite saved search formula that sums distinct values within a date range

I am trying to create a saved search of time entries in Netsuite.
Under criteria, I have specified a date range. This varies as this is an available filter
For the purposes of this example, the date range is 1/4/2020 to 10/4/2020
The first column ('Total Customer Billable Hours') in this sums all time entries that are coded against project task type 'billable project'. The formula I am using for this:
Formula (Numeric), sum, Case when {project.task_type}='Billable' then {durationdecimal} else 0 end
For the second column, I want the sum of hours the employee would normally work (in the time period specified under criteria-1/4/2020 to 10/4/2020 in this example)
The formula I am using to sum this is
Formula(numeric), sum, {timesheet.workcalendarhoursdecimal}
However, this is multiplying the employee's weekly hours by the number of time entries that make up the 'Total customer billable hours' figure
i.e. if an employee works a 40 hour week, the formula is multiple 40 x 36 (the number of time entries that make up the customer billable figure for example)
What would the correct formula be so that the second column is only summing the employee's work calendar hours for the period specified in the criteria/available filter selection?
Try changing sum to maximum:
Formula(numeric), maximum, {timesheet.workcalendarhoursdecimal}

What is the correct Smartsheet formula for retrieving the number of appointments from today plus 7

I have a table in Smartsheets that has bookings in it.
If the appointment is confirmed it changes the status to scheduled. It also has a date assigned to it. I'm trying to use countifs to see how many are scheduled for the next 7 days.
This is the formula i have.
=COUNTIFS([Shoot Setup]:[Shoot Setup], "Styleshoots", [Date start]:[Date
start], >=TODAY(7))
This does not give me the correct value.
If i dont have the 7 modifier then it gives me the correct value for items scheduled from today.
But i want to just see the total for today plus 6 days 7 days in total.
Any suggestions?
The formula you've posted will return the count of rows where:
Shoot Setup = "Styleshoots"
AND
Date start is greater than or equal to seven days from today
Try using this formula instead:
=COUNTIFS([Shoot Setup]:[Shoot Setup], "Styleshoots", [Date start]:[Date start], >=TODAY(), [Date start]:[Date start], <=TODAY(7))
This formula will return the count of rows where:
Shoot Setup = "Styleshoots"
AND
Date start is greater than or equal to Today
AND
Date start is less than or equal to 7 days from today

How do I compute the moving average age of a product from the first day it is purchased?

I have a series of random data points with order date, expiry date and product category.
I am trying to compute 2 age variables, wherein 1 would compute the rolling age using just the order date (hence no expiry date) between order dates.
In other words, I don't need age determined based on current date but ones' relative to each data point in the data. As such, the average would keep increasing as more products are purchased and first ones get old. The second age variable would essentially cap each order by expiry date, which would mean the rolling average would not necessarily be increasing.
I am trying to do this using R or Tableau.

Count between months in Tableau

I am needing to count month between collect dates. I need to know if the test was run in the last 3 months. Below is the code I used but it is giving me a count of zero, but I know they had 3 of the same tests run in a year because I can see the dates. I understand the first one have a count of zero, because there is no test before that, but the count for the other should be 3, 5 respectively.
DATEDIFF('month',[Collect Date],[Collect Date])
Dates of the Tests.
1/8/2015
4/23/2015
9/30/2015
What you are looking for is possible using the LOOKUP function in Tableau. Keep in mind, that the result relies heavily on the data that is displayed and how it is displayed (sorted, etc).
You can create a calculated field like this:
DATEDIFF("month",LOOKUP(ATTR([Test Date]),-1),ATTR([Test Date]))
Which calculates the number of months between the date in the current row and the date from the prior row.
Your result will look something like this:

Resources