I am really stuck. I have a data model in PowerPivot 2013 with clients and entry dates and exit dates for specific programs. I need to find the overall length of time between entry and exit assuming that a client cannot physically be in more than one program concurrently and may leave for a period of time. The problem is that they can be enrolled in multiple programs concurrently. The calculations I've come up with are artificially inflating the length of overall time in any programs because of multiple enrollments. here is an example:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Client[/TD]
[TD]Program[/TD]
[TD]Entry Date[/TD]
[TD]Exit Date[/TD]
[TD]Length of Stay[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]A[/TD]
[TD]1/1/2014[/TD]
[TD]2/1/2016[/TD]
[TD]761[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]B[/TD]
[TD]1/1/2015 [/TD]
[TD]1/1/2016[/TD]
[TD]365[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]B[/TD]
[TD]2/1/2016[/TD]
[TD]3/25/2016[/TD]
[TD]53[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]C[/TD]
[TD]3/25/2016[/TD]
[TD]Null[/TD]
[TD]31[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]A[/TD]
[TD]2/1/2010[/TD]
[TD]2/9/2016[/TD]
[TD]2199[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]B[/TD]
[TD]2/20/2016[/TD]
[TD]Null[/TD]
[TD]65[/TD]
[/TR]
</tbody>[/TABLE]
The null values in the Exit Date column are substituted with the date of the report build which is 4/25/2016 to calculate the Length of Stay (LOS). I have a column that concatenates the client ID and the entry date to create a unique identifier for the entries. I have used MINX and MAXX with EARLIER to successfully return the first and last overall entries for each client but the cumulative LOS for each client should reflect only the LOS for the time in residence in the system rather than a sum of the individual programs or the time from the beginning to the end.
Some clients have hundreds of individual enrollments of a day or so, also.
Any help would be greatly appreciated.
Thanks!
Elizabeth
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Client[/TD]
[TD]Program[/TD]
[TD]Entry Date[/TD]
[TD]Exit Date[/TD]
[TD]Length of Stay[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]A[/TD]
[TD]1/1/2014[/TD]
[TD]2/1/2016[/TD]
[TD]761[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]B[/TD]
[TD]1/1/2015 [/TD]
[TD]1/1/2016[/TD]
[TD]365[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]B[/TD]
[TD]2/1/2016[/TD]
[TD]3/25/2016[/TD]
[TD]53[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]C[/TD]
[TD]3/25/2016[/TD]
[TD]Null[/TD]
[TD]31[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]A[/TD]
[TD]2/1/2010[/TD]
[TD]2/9/2016[/TD]
[TD]2199[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]B[/TD]
[TD]2/20/2016[/TD]
[TD]Null[/TD]
[TD]65[/TD]
[/TR]
</tbody>[/TABLE]
The null values in the Exit Date column are substituted with the date of the report build which is 4/25/2016 to calculate the Length of Stay (LOS). I have a column that concatenates the client ID and the entry date to create a unique identifier for the entries. I have used MINX and MAXX with EARLIER to successfully return the first and last overall entries for each client but the cumulative LOS for each client should reflect only the LOS for the time in residence in the system rather than a sum of the individual programs or the time from the beginning to the end.
- Client 1 should have an LOS of 845 days in the system. The correct LOS would be from Program A and the second program B and program C, but ignore the overlapping enrollment in the first Program B enrollment.
- Client 2 should have an LOS of 2264 in the system because they were not in the system for a few days between the end of their time in program A and beginning of their time in program B.
Some clients have hundreds of individual enrollments of a day or so, also.
Any help would be greatly appreciated.
Thanks!
Elizabeth