 # Count number Fridays in a given period

Hello Team, I have been struggling with counting a number day ( Monday, Tuesday, Wednesday etc) in a [Start date] and [End date]

@Servatec
Should [StartDate] and [EndDate] be counted if either of them falls into Friday? Try with this first:

``````NUMBER((WEEKDAY([StartDate] - 6)-[StartDate]+[EndDate])/7)
``````

Bear in mind that, the above expression also counts the Fridays if the Start and End dates also falls into Friday. Provided you want to omit them, you need to set an IFS expression:

``````IFS(
AND(
WEEKDAY([StartDate])=6,
WEEKDAY([EndDate])=6
),NUMBER((WEEKDAY([StartDate] - 6)-[StartDate]+[EndDate])/7)-2,
OR(
WEEKDAY([StartDate])=6,
WEEKDAY([EndDate])=6
),NUMBER((WEEKDAY([StartDate] - 6)-[StartDate]+[EndDate])/7)-1,
TRUE,NUMBER((WEEKDAY([StartDate] - 6)-[StartDate]+[EndDate])/7)
)
``````
3 Likes

COUNT(SELECT(DatesTable[Date],AND([Date]>=[Start Date],[Date]<=[End Date],WEEKDAY([Date])=[DayToCount])))

I ended up with this, having [DayToCount] Enum to select the day.

2 Likes

Great. Not necessarily fall on Friday but to count number of occurrences of a day with a given period start to end date

I am counting the days from my Shifts table.
By having the conditions <= and >= the selected dates are included.
Not to be included the just use < and >.

In the example below, only had 3 Monday shifts.  2 Likes

Woooaoooh thanks a lot more than a magic

1 Like

Trying implement your formula here I think finding it difficult to.

I want to use created (date) and today()
To get the number of Sundays.

Replace [From} with [Created] and [To] with TODAY()

1 Like