Dataview Table show current month events only or may be within 7 days events only

Things I have tried


TABLE WITHOUT ID split(sub, "\|")[0] AS "Event",

date(split(sub, "\| ")[1]) AS "Date"

WHERE event FLATTEN event

AS sub SORT date(split(sub, "\| ")[1])

ASC

What I’m trying to do

I have an md file having events and birthdays etc. And i have dataview query to show them in a table. The thing is i am not able to figure out how to show events for this month only.

md file:

event:: Autumn starting | 2022-09-03
event:: Winter starting | 2022-12-07
birthday:: December Third Quarter | 2022-12-16

dataview query:

Events Dashboard


TABLE WITHOUT ID split(sub, "\|")[0] AS "Event",

date(split(sub, "\| ")[1]) AS "Date"

WHERE event FLATTEN event

AS sub SORT date(split(sub, "\| ")[1])

ASC

Topic

Summary
  • How to calculate the durations from the sources like case_DVIF_DSS?

Test

Summary
  • dataview: v0.5.41

Input

Summary

dictionary files

  • Location: “100_Project/02_dataview/Q87_DVIF_DSS/Q87_test_data”
  • filename : dic_19990301
---
Date: 1999-03-01
---

event:: Autumn starting_A | 2022-09-09
event:: Winter starting | 2022-12-01
event:: birthday | 2022-09-06



  • filename : dic_19990401
---
Date: 1999-04-01
---

event:: Autumn starting_B | 2022-09-11
event:: birthday | 1992-09-21



  • filename : dic_19990501
---
Date: 1999-05-01
---

event:: What starting01 | 2022-08-30
event:: What starting02 | 2022-08-31
event:: Autumn starting_C | 2022-09-07
event:: Autumn starting_D | 2022-09-12
event:: What starting05 | 2022-09-20
event:: What starting06 | 2022-09-21
event:: Winter starting | 2022-12-05
event:: birthday | 1980-09-28



  • filename : dic_19990601
---
Date: 1999-06-01
---

event:: 



  • filename : dic_19990701
---
Date: 1999-07-01
---

event:: 
event:: 




DQL20_filter_by_yyyy_MM_and_durations_and_TABLE

Summary

Main DQL

Code Name Data type Group By Purposes Remark
DQL20_filter_by_yyyy_MM
_and_durations_and_TABLE
durations no 1.To define a field variable F_event
2.To define a field variable Title, cDate, F_dur_days
3.To filter by yyyy_MM or by F_dur_days
4.To sort by cDate in ascending order
5.To display the result as a table

DQL20_filter_by_yyyy_MM_and_durations_and_TABLE

Summary_code
title: DQL20_filter_by_yyyy_MM_and_durations_and_TABLE =>1.To define a field variable `F_event` 2.To define a field variable `Title`, `cDate`, `F_dur_days` 3.To filter by yyyy_MM or by F_dur_days 4.To sort by cDate in ascending order 5.To display the result as a table
collapse: close
icon: 
color: 
```dataview
TABLE WITHOUT ID 
      Title AS "event",
	  cDate AS "Date"
FROM "100_Project/02_dataview/Q87_DVIF_DSS/Q87_test_data"
WHERE event != null       

FLATTEN event AS F_event
WHERE F_event != null 
FLATTEN split(F_event, "\s+\|\s+")[0] AS Title
FLATTEN split(F_event, "\s+\|\s+")[1] AS cDate
WHERE date(cDate) != null
FLATTEN dur(date("today") - date(cDate)).days AS F_dur_days
WHERE dateformat(date(cDate),"yyyy_MM") = dateformat(date("today"),"yyyy_MM")
      OR (F_dur_days < 7 AND F_dur_days >= 0)
      OR (contains(Title, "birthday") AND dateformat(date(cDate),"MM") = dateformat(date("today"),"MM"))
SORT cDate ASC

```

Screenshots(DQL20): today=“2022-09-13”


2 Likes