Help with dataview query

Hi
I have the following dataview query which is a habit tracker. As you can see I use the daily notes plugin and file.link to sort according to the file name (which is the date)
how can change the query so that it shows me results of the past 10 days? and so that it adjusts dynamically according to every new day?

thanks!

We can’t really see anything, and most of us are really terrible mind readers. So unless you provide some more info, I’m afraid we can’t really help you with anything.

hahah my bad. i forgot to paste. here goes:

TABLE WITHOUT ID
file.link AS "Fecha",
AguaFría, Meditación, Ejercicio, Leer, Concentración, HoraDormir
FROM "Todas/Periodic notes/Diarias"
SORT file.ctime asc

Actually, don’t use this post, see the post below.


This?

1. template

```dataview
TABLE WITHOUT ID
file.link AS "Fecha",
AguaFría, Meditación, Ejercicio, Leer, Concentración, HoraDormir
FROM "Todas/Periodic notes/Diarias"
WHERE file.day <= date({{date:YYYY-MM-DD}}) AND file.day >= date({{date:YYYY-MM-DD}}) - dur(10days)
SORT file.ctime asc
LIMIT 10
```

2. test for today’s date

```dataview
TABLE WITHOUT ID
file.link AS "Fecha",
AguaFría, Meditación, Ejercicio, Leer, Concentración, HoraDormir
FROM "Todas/Periodic notes/Diarias"
WHERE file.day <= date(2023-02-17) AND file.day >= date(2023-02-17) - dur(10days)
SORT file.ctime asc
LIMIT 10
```

thank you! i tried that but got this response: Dataview: Error:
– PARSING FAILED --------------------------------------------------

1 | file.link AS “Fecha”,
| ^
2 | AguaFría, Meditación, Ejercicio, Leer, Concentración, HoraDormir
3 | FROM “Todas/Periodic notes/Diarias”

Expected:

TABLE or LIST or TASK or CALENDAR

It seems like you’ve not copied the first line of the query, the TABLE WITHOUT ID line. Try that, and see what happens then.

1 Like

This is better, I think:

```dataview
TABLE WITHOUT ID
	file.link AS "Fecha",
	AguaFría,
	Meditación,
	Ejercicio, 
	Leer, 
	Concentración, 
	HoraDormir
FROM 
	"Todas/Periodic notes/Diarias"
WHERE 
	file.day > this.file.day - dur(10 days)
	where file.day <= this.file.day
SORT
	file.name
	DESC
```

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