blacksmithgu / obsidian-dataview

A data index and query language over Markdown files, for https://obsidian.md/.
https://blacksmithgu.github.io/obsidian-dataview/
MIT License
6.97k stars 409 forks source link

Group keys in same file #1387

Open Chompas opened 2 years ago

Chompas commented 2 years ago

Is your feature request related to a problem? Please describe. I'm using weekly notes where I add comments but also I want to track different activities. For a note in a week I may have repeated entries.

activity:: Swim
activity-duration:: 60 minutes

activity:: Run
activity-duration:: 40 minutes

activity:: Swim
activity-duration:: 30 minutes

This will happen within the same note but also in multiple weekly notes but there's no form to query and group this information.

Describe the solution you'd like I'd like "group by" to accept this behavior so I can eventually query a summary and create a table that will show the sum of time I spent grouped by activity.

Describe alternatives you've considered An alternative could be to create one note per day but still some activities (as watching a TV Show) may repeat in the same document

Additional context When running this query

table activity, sum(activity-duration) as "Duration", length(rows.activity) as count
from "Weekly Notes"
group by activity

I get this as result

image
AB1908 commented 2 years ago

Another alternative is to define your activities directly by name, e.g. swim:: 60 mins. This does make querying difficult however.