How do I exclude weekends(sat and sun) and public holidays when counting number of days between a start and end time in sharepoint 2010 calculate column.
You can exclude weekends like this in the calculated column:
=IF(AND((WEEKDAY(EndDate,2))<(WEEKDAY(StartDate,2)),((WEEKDAY(StartDate,2))-(WEEKDAY(EndDate,2)))>1),(((DATEDIF(StartDate,EndDate,"D")+1))-(FLOOR((DATEDIF(StartDate,EndDate,"D")+1)/7,1)*2)-2),(((DATEDIF(StartDate,EndDate,"D")+1))-(FLOOR((DATEDIF(StartDate,EndDate,"D")+1)/7,1)*2)))
I don't know how about public holidays :)
Related
If I have sunday as non working day and Monday as Public holiday how to exclude these days while calculating the time difference between the record created date and the time when the record was called for the first time. Creation_time, Attempt_time are attributes available.
The data for holidays list is loaded in a separate table.
I am trying to dynamically get the dates, starting from begging of month to current date using SSAS Tabular - DAX, I have tried many date functions but I couldn't end up with solution, so is there any idea to share pls ?
The following DAX function will return a table of DATES for each day from the start of the current month through today:
DatesMTD = CALENDAR(DATE(YEAR(TODAY()), MONTH(TODAY()), 1), TODAY())
To be able to filter the dates for the first 10 days, create a calculated column that identifies as a date in this range
1st to 10th Date = If(Day([Date]) <11,1,0)
This can then be used to either filter out the dates past the 10th of each month
I have approximately the same table (excluding count column). I want to calculate the number of working days (Mon-Fri) and exclude public holidays.
I tried to try the following query
SELECT count(distinct(date)) from MYDB where dummy <> 1
However, it gives the only total number of days including weekends. Additionally, if use this command it counts distinct dates, however, my dates do not show a full month, so another logic should've used. Could you help to figure out which code is better to use?
there should be a function in Vertica that extracts weekday from date, so to exclude weekends you'll need to add another condition like
extract(dow from date) not in (6,0)
(6 is Sat, 0 is Sun in this case)
I'm using Microsoft Access to calculate the number of holidays of doctors. Doctors have up to 31 days for holidays per year from where I extract the count of holidays.
However I don't want to count the weekends between start and end days.
Currently my code is the following, which counts the weekends:
TRANSFORM 31-Nz(Sum(DateDiff("d",DateAdd("d",-1,leaves.leave_starting_date),leaves.leave_end_date)),0) AS Days
SELECT doctors.Name
FROM doctors LEFT JOIN leaves ON doctors.ID = leaves.doctor_id
GROUP BY doctors.Name
PIVOT Year(leaves.leave_starting_date);
Any help?
Replace DateDiff with a function that excludes weekends (and, optionally, public holidays as well) from the difference in calendar days.
An example is my function DateDiffWorkdays posted here.
I have a set of data which includes an account #, and a fiscal end date. The fiscal end date does not always match the calendar year. I need to take the given fiscal end date and generate the quarters based on it. For example, if fiscal end date equals 6/31 then the first quarter would be 7/01 thru 9/30, second would be 10/1 thru 12/31, etc.
The only way I can currently think to do this would be a very long and complicated if/then structure. Any help making something more efficient would be greatly appreciated.
You can use DATEADD() function
select convert(varchar(10),dateadd(day,1,'6/25/2016'),101) as startdate,
convert(varchar(10),dateadd(month,3,dateadd(day,1,'6/25/2016')),101) as enddate
Result will be like: