I have a template that I use to note my hours worked. In it I use the inline field:
Hours::
I can collect the data for the last week using a table, and it works fine:
table
Day,
time-start as Start,
time-end as End,
Hours
from #work
where date(file.day).weekyear = date(2021-11-22).weekyear and date(file.day).year = 2021
sort date(file.day) asc
This works fine.
What I’m trying to do
But what I’d like is to be able to grab all the entries from the Hours column for that same week and add them all up.
In pseudo code it might look something like:
=sum(all Hours from #work where the date is this week)
For your goal, one possibility is to create another table (or list) after your main table with something like this:
TABLE WITHOUT ID
sum(rows.Hours) AS "Hours (Week total)"
FROM #work
WHERE date(file.day).weekyear = date(2021-11-22).weekyear AND date(file.day).year = 2021
FLATTEN date(file.day).weekyear AS Week
GROUP BY Week
The trick is define one common property for all listed notes (the week) and group them in that single property…
I write my hours as quarter hour increments (the smallest amount I want to track, for sanity purposes) so like 0.25, 0.5, 0.75, 1, etc. And each work period is recorded in a separate file with the #work tag and Hours:: attribution.