Friends i have notes with metadata like this:
What im trying to do with dataview is to sum all begins and ends with all my notes, to have a better overview
but im only getting the total of begin and end of each note with this code:
TABLE sum(begin) as test, sum(end) as test2
tried group by but also didnt achieve
Any tips ?
Thanks in advance !
Could you provide a little more information? Such as:
- A few examples of what’s in your “begin” and “end” fields, and
- What you want the output to look like?
Example note 1:
Example note 2:
Example note 3:
- would like to dataview take all my notes and sum all the “begins” and “ends”, so the output in this example would be :
- total begins: 11
- total ends: 35
One example for “total begin” using DQL:
LIST "total begins: " + sum(rows.begin)
GROUP BY true
Haha, @mnvwvnm beat me to it!
I’ll add a little more context to his good answer:
The sum() function works on an array of values. One way to get a sum like this is to put all of your pages into a group. Here’s a query that does that:
TABLE WITHOUT ID
sum(rows.begin) as BeginTotal,
sum(rows.end) as EndTotal
WHERE begin AND end
GROUP BY ""
Here’s what it looks like in action:
Let’s break down the query:
TABLE WITHOUT ID - don’t show the File column since we don’t need it.
sum(rows.begin) as BeginTotal, - Sum the “begin” fields into the BeginTotal field.
sum(rows.end) as EndTotal - Sum the “end” fields into the EndTotal field.
FROM “Test” - Only look in the folder called “Test” (this is specific to my vault. ).
WHERE begin AND end - Only look at pages that have both a
end field (again, maybe specific to my vault).
GROUP BY “” - Put all the pages into a single group. I use an empty string here, @mnvwvnm used
true – either works.
I hope this helps! Happy Dataviewing!
thanks bro, you guys are the dataview kings
thanks bro, you guys are the dataview kings, happy holidays to you all
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.