TLDR
How do I use aggregate functions (like max(), sum(), etc.) after a GROUP BY phrase in a dataview query?
What I’m trying to do
My base contains a series of notes on characters for some writing I’m doing. Those notes each contain their schedule for the various days, organized as a series of tasks. Each task has a time and location associated with it. My goal right now is to get the latest event for each character, before a certain time.
So far, I have been able to include a time filter and group by each character as follows:
FROM "Codex/Characters"
WHERE area=[[Main town]] AND time < date(2025-10-01T15:00:00)
GROUP BY file.name
which yields this:
My question now is: How can I only display the latest event for each character?
Things I have tried
I have scoured Dataview’s docs as well as many comunity forum pages. I have also looked through examples in the Dataview example vault. Unfortunately, all examples I’ve seen only ever include a SORT or another GROUP BY statement after the first.
Are there any resources I’ve missed? Thanks!
