Announcements
You can succeed best and quickest by helping others to succeed. Join the conversation.
cancel
Showing results for
Did you mean:
Not applicable

## ¿How to count Saturdays in date range?

Hi there,

I need your help to solve my issue, i need to count saturdays in date range:

I have a field with date (Format: DD/MM/YYYY hh:mm:ss) and i make filters in diferents range but i need only count how many saturdays exist into this range selected (the range is variable).

Thanks for all!.

1 Solution

Accepted Solutions
MVP

You have changed the system variable FirstWeekDay, which influences Weekday() function.

You can correct this like

Div(WEEKDAY(Min([Creation Time])-6,0)+1-Min([Creation Time])+Max([Creation Time]),7)

17 Replies
MVP

Maybe like shown here

Re: Count of Saturday in whole month

=Div(WEEKDAY(Min(DateField)-6)+1-Min(DateField)+Max(DateField),7)

Partner - Creator III

in script;

aa:

WeekDay(data) as week_name;

1/1/2016

2/1/2016

3/1/2016

4/1/2016];

and in interface

count(distinct if(week_name='Sat',data))

Not applicable
Author

Does not work!

MVP

Div(Date2-Date1,7) + (WeekDay(Date1)<=5)*(WeekDay(Date2)>=5)

MVP

'Does not work' is not a really helpful issue description.

Do you get an error, no value, wrong value?

(I assume you have replaced DateField with the field name of your date field).

See attached a sample QVW.

Partner - Creator III

see this attach

Not applicable
Author

Does not work, this formule is counting 1 with any saturdays selected.

Champion

Maybe try,

Count(If(Weekday(DateField)='Sat',1))

Contributor III

Hi, I suggest to use additional field with number of weekday, which we have to add in the load script. And than you can use expression like this "Count({<WeekDayField = {5}>} DISTINCT DateField)". We have to use integer values in DateField. That's why we should use transformation for it: Floor(BaseDateField).

Community Browser