Working example for working hours per day with dataview

Hey guys,

I was trying to get a simple summary of my working hours of every day. Greatly appreciate the examples in several forum posts like this one link and link.

My examples works with a daily note with the following header:

clock-in: <%"YYYY-MM-DDThh:mm") %>
clock-out: <%"YYYY-MM-DDThh:mm") %>
share_RnD: 0.5
  - daily

and then I collect the working days for each month with the following dataview query which is created with templater as well:

  - stundenzettel
cssclass: academia, academia-rounded

dateformat(date(file.frontmatter.clock-in), "cccc") as "Wochentag", dateformat(date(file.frontmatter.clock-in), "HH:mm") as "Start", dateformat(date(file.frontmatter.clock-out), "HH:mm") as "Ende", 
durationformat(date(clock-out) - date(clock-in) - dur(30m), "hh:mm") as "Arbeitszeit",
durationformat(file.frontmatter.share_RnD * (date(clock-out) - date(clock-in) - dur(30m)), "hh:mm") as "Anteil RnD"
FROM #daily 
WHERE file.ctime.month = date("2024-05").month AND file.ctime.year = date("2024-05").year AND path != "Struktur"

With this setup I get a simple but helpful table for each day where I can even get the share of my work of each day on a certain project β€œRnD”.


Maybe you have ideas on how to improve the code or maybe somebody may find it helpful.

1 Like