Handling sublevels in dataview MOC

Yes, I agree, it looks like contains() is only checking the root of the link, not the other subheadings.

That being said there is an simpler solution. To find the notes for, say September 2024:

LIST
WHERE date(file.name).month = 9 AND date(file.name).year = 2024

Then October would be date(file.name).month = 10, etc.