Hi @Vytenis !
I might have a little something for you there for both your questions
Using this post as a base : Calculate all months in a range (20x faster) , I ended up with this formula to count Sundays (weekday n°1) in a date range :
(for some ease, I created a field Today
in my test doc, but the formula works with Today()
too and as CountIf()
is a slow formula which can lead to performance problem, I didn’t use it )
Sequence(thisRow.[Date X],thisRow.Today).FormulaMap(ToDate(CurrentValue).Weekday()).Filter(CurrentValue=1).Count()
Therefore, for counting Saturdays and Sundays the formula is :
Sequence(thisRow.[Date X],thisRow.Today).FormulaMap(ToDate(CurrentValue).Weekday()).Filter(CurrentValue=1 OR CurrentValue=7).Count()
Which means that you can count any weekdays simply by changing the number of the CurrentValue
in the Filter()
(there’s an example with counting Mondays, Wednesdays and Fridays in the test doc )
The fields Dates between Today & Date X [List]
and Dates between Today & Date X : Weekdays [List]
are just there for visual help