Daily metadata in weekly notes

Hello everyone,

I’m new to Obsidian (but am a developer, so not afraid of custom solutions or coding, if required) but trying to set up my ideal workflow. I want to use Dataview to aggregate some sort of daily data (exercise, practice etc.) but I’d like to avoid creating a daily note, if possible.

I usually retrospect every two weeks, so what I would like to do (ideally), is create a fortnightly note with my retrospective and, within it include sections where I could store the daily data. So, it would look something like this:

# Week 1–2

// My notes go here ...

## Daily data
### 19700101
---
  exercise: 10
  practice: 20
---
### 19700101
---
  exercise: 15
  practice: 5
---

// etc.

I understand that a MD file can only have one frontmatter with metadata, but I wonder if there is a workaround or some way to structure the page/metadata or to query for data with Dataview that would allow me to do this.

My main motivation is to avoid having a proliferation of metadata-only daily notes in my filesystem.

As a newbie, any help is greatly appreciated!

You can try inline metadata fields something like this.

  • [date:: 1970-01-01] [exercise:: 10] [practice:: 20]
  • [date:: 1970-01-02] [exercise:: 20] [practice:: 5]

I guess that there would be some trouble if there are two sets of data for the same date.

I think the better option, which are very easy to query using dataview, is to use lists:

- (date:: 1970-01-01) [exercise:: 10]
- (date:: 1970-01-01) [practice:: 10]
- (date:: 1970-01-02) [exercise:: 15]
- (date:: 1970-01-02) [practice:: 5]

Which would show up in the default theme something like this:
image

(It can be styled to your liking, rather easily).

This then allows for queries where you can pull out the various stuff like, the exercises using something like:

```dataview
TABLE WITHOUT ID item.date as Date, item.exercise as "Exercise count"
FLATTEN file.lists as item
WHERE file.name = this.file.name
WHERE item.exercise
```

With output:

PS! My post was written at the same time as obsidian337’s post, and stands freely related to that

Thanks a lot for your answer!

I’m exploring solutions, a mix of your solution and mine that I though about was to do something like:

#### 2023-01-01
- [practice:: 45 mins]
- [exercise:: 30 mins]

Then, with dataviewjs I can filter for the annotated property and then take the item.section.subpath to get the date from the heading.

Your solution also looks nice and potentially more compact and more DQL-friendly. I’m wondering two things:

  1. Why not putting all the data for one date in one line? E.g.
    - (date:: 1970-01-01) [exercise:: 10] [practice:: 10]
  2. What’s the syntax difference between using square vs round brackets?

Thanks a lot for the answer again, both of you have put my on the right track!

If you put both in one line, then you will not be able to separate them properly, if that is needed down the line. E.g. if you want to have a chart where you would sum up exercise in one column and practice in another column.

It would be a different story if you wanted to record that you exercised for 30 minutes, and in that session you did push-ups in a 3 x 10 repetitions. That I would write up in one line as that is “one unit” of data, if you follow my train of thoughts.

Square brackets will show the field name, round brackets will hide the field name. In the example given, I don’t need to see that the date is n date, but I want to see what the 10 is. Is that 10 exercises or 10 practices, or 10 of something entirely different?

I’m using a lot of dataviewjs, so that’s indeed a viable solution. Just wanted to mention that using meta(... ) you can also access stuff like subpath within the ordinary DQL queries. So if I’d added my test data under some section header, I could have used meta(item.section).subpath to get to that heading.

Thanks a lot for your time! That works! :slight_smile:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.