← [[Automated Notes|Intro]] ⦿ [[Prerequisites]] ⦿ [[Create a daily note|Create]] ⦿ [[Daily note with Time Tracking|Track]] ⦿ [[Weekly Notes|Weekly]] ⦿ [[Dynamic content|Dynamic]] ⦿ [[Reports|Reports]] ⦿ Samples → There are many ways to extract insights from your notes, the latest addition to Obsidian -- [Bases](https://help.obsidian.md/bases) -- accomplishes this quite well. ## Reporting with Bases You can create bases as separate files, transclude them (e.g. `![[linktobase]]`), or as a [code block](https://help.obsidian.md/syntax#Code+blocks). I prefer [embedding the base in a code block](https://help.obsidian.md/bases/create-base#Embed+a+base+as+a+code+block) because I can edit it directly in Obsidian. Create a note called `Hours` with at least one blank line at the start and end, and in the middle insert this: ~~~ ```base ``` ~~~ >*Simply put: 3 backticks, the word 'base', return, return, 3 backticks, return.* This sets you up to edit the base in your note if you need, even though you can do most of the config via the UI. The Bases documentation for [toolbars](https://help.obsidian.md/bases/views#Toolbar) covers this quite well, so I'll focus on what gets into the base block. You need to add formulae and summaries to make it worthwhile. I'll explain each element: - `summaries.Total`: sum total of hours. Summaries of formulae are funky, requiring a map/reduce to get simple sums. - `filters.and.[]`: selects what to show, notes that are in the `Daily` folder and have the `daily` type. - `formulas.*`: - `workHours`: end - start is your working hours - `net`: net time sum for the day, handles breaks, holiday, vacation - The rest is mainly formatting, except for... - `views[0].summaries.formula.net`: builds the grouped total for the week This is the straight up base text ↓ ``` summaries: Total: values.map(number(value)).reduce(if(value, value, 0) + acc,0).toFixed(1) filters: and: - file.folder == "Daily" - type == "daily" formulas: work_hrs: |- if(date(file.name+"T"+note.end_time)-date(file.name+"T"+note.start_time), (date(file.name+"T"+note.end_time)-date(file.name+"T"+note.start_time)).hours, 0) net: number((formula.work_hrs - breaks + holiday + vacation).toFixed(1)) views: - type: table name: Table groupBy: property: week direction: DESC order: - file.name - start_time - end_time - breaks - holiday - vacation - formula.net sort: - property: week direction: DESC - property: file.name direction: DESC summaries: formula.net: Total ``` If you're lucky, when you view the base it'll look like: ![[Hours.png]]