I have a daily log of worked shifts over 12 months period with the following structure:
ShiftStart_DateTime | ShiftEnd_DateTime | Total hours between a shift
01/05/2020 08:00 am | 01/06/2020 9:00 am | 1 days 1 hrs 0 mins
Note: Total hours between a shift Calculated using array formula discussed in this forum
={“Total hours between a shift”;ARRAYFORMULA(IF(ISBLANK(A2:A),“”,INT(C2:C-B2:B)&" days “&TEXT(C2:C-B2:B,“h”” hrs ““m”” mins “”")))})
and trying to produce a report to show total hours made on monthly basis i.e.
Month | Total Hours
Jan | 20
Feb | 10
…
Dec | 30
Totals | 60
Any chance time calculations make it into the Glide Editor? Now that date/time can be easily formatted in the editor, if you could calculate the time between two “Time Only” values, you could easily run a number of calculations without any lag in the app. I could see issues with times that go over two dates, but this could be limited to simple calcs of same-day times.
How will the user select the year/month?
What will the interface look like?
Will they just select from a datepicker, or something more elaborate?
That’s your starting point, so I need to know what that is before I advise on the rest.
Although, because you want to ultimately do a rollup, you’re better off just creating a multiple relation. The if-then-else approach is better suited when you just want to do a date based filter.
Anyway, this is what I would suggest:
Firstly, you need a user specific date/time column to hold the users selected date
Create a Math column using the following formula: Year(Date) * 100 + Month(Date)
– This converts the selected date into an integer representing the year and month
Now, in the table that contains your data records, create the exact same math column, substituting the date column that you want to match on.
Back in the table that contains your user specific column, create a multiple relation column. This should match the converted date (math) column with the same column in your data table.
You can now do your rollups through that multiple relation column.
They can, but it’s usually cleaner if you keep them separate.
From your screen shot, it looks like your user specific date value is being written to different rows. This suggests to me that you’re starting with a list view, then navigating to a details screen and selecting the date from there. That isn’t going to work. You need to set it up so that your user specific value is always written to the first row.
Which App/Screen is this? I can have a quick look and suggest the best way forward.
I have a Attendance Table which does not have a View Tab yet. I am trying out the feasibility before deciding where to put the Date Picker… Probably in the User Table (User Tab)
Yes, it’s a duration formatted as HH:MM:SS. Under the covers, it’s still a number (of days) - and that’s what you used to get when you subtracted one date/time from another. But Glide changed this behaviour a while back. Apparently the change was needed for AirTable support.
There is probably an easier way to convert decimal hours to hh:mm, but this is what I do:
Create a math column to extract the whole number of hours
– Trunc(Round(Hours,2))