# How to calculate weekend days in a range of time?

I need to know how many Saturdays and Sundays there are between a range of dates. This would also work if I wanted to know the qty for a specific day (e.g. amount for Tuesday or Friday).

I saw this other post to know the number of working days but I have not been able to make it work in reverse.

Hi @DannyV, We should be able to count the weekends between a date range using extract function to get day of the week as an integer. Let me know if below logic helps. This can be extended for any day of the week.
Create two parameters. One for start date and another for end date. This will help define the date range and for this defined date range we will count the Order Date where day of the week is either 1 or 7.
Count Weekend : distinct_countIf({Order Date},
{Order Date}>=\${pstartdate} and {Order Date}<=\${penddate} and (extract(āWDā,{Order Date})=1 or extract(āWDā,{Order Date})=7))

Regards,
Karthik

Hi @Karthik_Tharmarajan, I appreciate the help. I understand the syntax of the calculation, however I think it does not work for what I need, because here we are seeing the orders that were created on weekends.

In my case I have the following: I have two fields where I can see the start and end date of the tickets, I have the total number of days that the ticket was open and I need to know from this total how many days were, for example, sundays or a specific day.

Hi @DannyV ! Apologies for the delay. Please let me know if below option works for you. I have shared the calculation logic below the table. Depending on the day of the week you want to count you can modify the calculation.
If this helps please mark this solved.

Regards,
Karthik

1 Like