Hi,
I used the next code. It's part of larger code that must calculate how many Mondays, Tuesdays ..ect there are in a Year without the holidays and weekends.
Sum(
With(
{
// generate a one-column table of all dates between start date & end date
varDateRange: ForAll(
Sequence(DateValue(“3-27-2023”) – DateValue(“1-1-2023”) + 1),
DateValue(“1-1-2023”) + Value – 1
)
},
CountIf(
varDateRange,
Weekday(Value) in [2]
)
)
)
But I see a weird thing happen. With this code I mis 1 Monday in the Year 2023. After some research I saw that Monday 27th is not counted as the 13th Monday of the year. If I use the 28th or March or April 4th the total number will be 13. Was do I wrong.
Can someone help me with this problem?