How to create a multi-criteria query in Dataview

What I’m trying to do

Hey guys, I create daily notes that log my days, containing stuff such as tasks, thoughts, etc. Now I want to use a dataview table to query each daily note and find out how many tasks I did that day or how many thoughts I had that day. I’m stuck with how to create the criteria.

Things I have tried

This is my code, as I want to calculate how many thoughts I had this day. I have a folder dedicated for my thoughts, so I just reference the thought within that day. Because links can link to other things rather than just thoughts, I want to know how I can calculate only the number of thoughts. Thanks guys!

table without id
	file.link as Date,
	Summary,
	length(file.outlinks) + length(file.inlinks) as Thoughts,
	Mood
from "00 Journals/Daily Notes"
sort file.cday desc

If each thought has a dedicated for in a different folder, you might want to flip the logic and check files in that folder which links to a given daily note, and count those files.

The other way, like your aiming at now, would require filtering the thoughts link either by destination folder (which is sketchy) or checking links belonging in the Thoughts section. Doable, but can be a little iffy…

Actually, every thought is placed within one dedicated folder, so it would be easy to locate. I see your point, but I’m not sure how I can achieve that with codes.

I have another idea which is to calculate how many “thought” links a single day’s page has by placing the formula in the yaml in each daily note, and then use the dataview to query that. But I’m also stuck here because inline DQL seemingly cannot perform “WHERE” or “FROM”. Perhaps dataview js would help, but I have no idea where to start.

Here’s what I’m trying to achieve for daily note: = length(this.file.inlinks) from "05 Notes".

I am just dropping thoughts here, obsidian query language plugin might work in this scenario despite i have never used it.

I ran into a similar problem and posted my solution here:

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