Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
For Example,
April 2016 has 30 days and 5 Saturdays.
I want to count only those 5 Saturdays,even if they aren't passed.
For instance today is(4th Apr 2016) Still the count should be 5 Saturdays.
This should work for every month.
Regards,
Mohammad
You can use something like
=Div(WEEKDAY(StartDate-6)+1-StartDate+EndDate,7)
=Div(WEEKDAY(Monthstart(today())-6)+1-Monthstart(today())+Floor(MonthEnd(today())),7)
to count the number of saturdays in a date range (StartDate, EndDate)
Or use a master calendar with added Weekday Count data, like indicated above (but maybe with additional monthly aggregations).
Hi,
You can create a flag.
Load if(WeekDay(Date) = 'Sat',1,0) as SatFlag
From xyz;
and then use the Sum(SatFlag) in chart.
Regards,
Kaushik Solanki
Are you wanting to do this in the script or the front end?
You can use something like
=Div(WEEKDAY(StartDate-6)+1-StartDate+EndDate,7)
=Div(WEEKDAY(Monthstart(today())-6)+1-Monthstart(today())+Floor(MonthEnd(today())),7)
to count the number of saturdays in a date range (StartDate, EndDate)
Or use a master calendar with added Weekday Count data, like indicated above (but maybe with additional monthly aggregations).
@Sunny in frontend...
I want Count of Satudary is 5...
Try like this
Sum(If(weekDay(date_field)='Sat',1,0))
Please help me with this issue.
I'm not Sunny, but have you tried my expressions I've suggested above?
I would seriously suggest you to try Stefan's provided solution. More often then not his solutions are the best you will find on the community. So I urge you to not disregard his responses.
If it still doesn't work, then I don't mind chipping in, but I doubt that's going to happen
Hi Mohammad
If you want to calculate the number of Saturdays in a month(April), it all depends on if you have data for the rest of the month (ie. after the 4th Apr 2016).
The formula - 'Sum(If(weekDay(date_field)='Sat',1,0))' will work but, if you only have data up until the 4th Apr 2016 then the answer will be 1, if you have data for the whole of April 2016 it will be 5