I hope this makes sense! I am trying to create a column in a report that determines the number of days a child was in a foster home for the selected (last) month. My issues/variables are around the begin & end dates. Scenarios could be: 1) start date is prior to last month, no end date last month, so we count the whole month; 2) start date is prior to last month, end date is last month, we count 1st to end date; 3) start date is on or after the 1st of last month, no end date, we count start date through end of last month; & 4) start date is on or after the 1st of last month, end date is during last month, we count the days placed. !!! Okay, I have 2 formulas that work for parts.
This one works for #s 1 & 2:
=If(([Placement Begin Date]<[Last Month Begin Date]);(If(IsNull([Placement End Date]); DaysBetween([Last Month Begin Date];RelativeDate([Last Month End Date];1)); DaysBetween ([Last Month Begin Date];[Placement End Date]))))
and this one works for #s 3 & 4
=If(([Placement Begin Date]>=[Last Month Begin Date]);(If(IsNull([Placement End Date]); DaysBetween([Placement Begin Date];RelativeDate([Last Month End Date];1)); DaysBetween ([Placement Begin Date];[Placement End Date]))))
But I can't figure out how to get them both into just 1 statement, so my results are in 1 column & not 2.
I hope I explained it clearly!
Thanks.
This one works for #s 1 & 2:
=If(([Placement Begin Date]<[Last Month Begin Date]);(If(IsNull([Placement End Date]); DaysBetween([Last Month Begin Date];RelativeDate([Last Month End Date];1)); DaysBetween ([Last Month Begin Date];[Placement End Date]))))
and this one works for #s 3 & 4
=If(([Placement Begin Date]>=[Last Month Begin Date]);(If(IsNull([Placement End Date]); DaysBetween([Placement Begin Date];RelativeDate([Last Month End Date];1)); DaysBetween ([Placement Begin Date];[Placement End Date]))))
But I can't figure out how to get them both into just 1 statement, so my results are in 1 column & not 2.
I hope I explained it clearly!
Thanks.