Hi! I am trying to create monthly columns that tell me if a staff worked the entire month, a portion of month or not at all. For example… staff 1 starts 9/8- 11/12 - my formula would show staff 1 worked 73% of the month. Same if staff 2 starts 8/31-9-1…would work 3% of september. I have it almost working…but issue with start date on the first of the month. Any ideas?
Thanks!
Matt
IF(
AND(
IS_BEFORE({Start Date},‘9-1-2019’),IS_BEFORE({End Date},‘9-1-2019’)),0,
IF(
AND(
OR(IS_SAME({Start Date},‘9-1-2019’),IS_BEFORE({Start Date},‘9-1-2019’)),IS_BEFORE({End Date},‘10-1-2019’)),DATETIME_DIFF(DATEADD({End Date},1,‘days’),‘9-1-2019’,‘days’)/
DATETIME_DIFF(‘10-1-2019’,‘9-1-2019’,‘days’),IF(AND(IS_BEFORE({Start Date},‘9-1-2019’),IS_BEFORE(‘9-30-2019’,{End Date})),1,
IF(AND(IS_BEFORE(‘9-1-2019’,{Start Date}),IS_BEFORE(‘9-30-2019’,{End Date})),(DATETIME_DIFF(‘10-1-2019’,{Start Date},‘days’))/(DATETIME_DIFF(‘10-1-2019’,‘9-1-2019’,‘days’)),
IF(AND(IS_BEFORE(‘8-31-2019’,{Start Date}),IS_BEFORE({End Date},‘10-1-2019’)),DATETIME_DIFF(DATEADD({End Date},1,‘days’),{Start Date},‘days’)/DATETIME_DIFF(‘10-1-2019’,‘9-1-2019’,‘days’),
IF(AND(IS_AFTER({Start Date},‘9-30-2019’),IS_AFTER({End Date},‘9-30-2019’)),0))))))