Dataview calculation for the number of weekdays between 2 dates #1911
MRobinson-dev
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I looked everywhere for a number of weekdays function but could not find one. so I played around and finally figured this out.
use case, I wanted a dataview query to show the number of weekdays from the day a ticket opened and the day it closed.
I have the following yaml
in this calculation, if there is no endDate, it uses Today just to show how many days it has been open
1 + 5-startDate.weekday + product([(choice(!endDate, date(today), endDate).weekyear) - startDate.weekyear - 1, 5]) + (choice(!endDate, date(today),endDate)).weekday as DevDays
so basically it adds how many days were there in the 1st week,
then how many days in the full weeks between,
then how many days in the last week (or today).
Beta Was this translation helpful? Give feedback.
All reactions