Forum Discussion
KatieGriffiths
8 years agoQrew Trainee
Hey
Sorry took longer than I thought-please know I do not expect a response...
I've been playing and ending up with syntax errors, I played around with the parenthesis... think that may have messed things up? I read and understand how the variable formula helps...
Here is what I did:
var date FirstDayofPriorMonth = AdjustMonth(FirstDayOfMonth(Today()),-1);
var date LastDayofPriorMonth = LastDayOfMonth($FirstDayofPriorMonth);
var date FirstDayStoredPriorMonth = If(
$BTC Admission Date <= $LastDayofPriorMonth and (IsNull $BTC Discharge Date or $BTC Discharge Date >= $FirstDayofPriorMonth),
Max($FirstDayofPriorMonth, $BTC Admission Date));
var date LastDayStoredPriorMonth = If(
IsNull($BTC Discharge Date) and not IsNull($FirstDayStoredPriorMonth), $LastDayofPriorMonth,
not IsNull($FirstDayStoredPriorMonth) and $BTC Discharge Date >= $FirstDayofPriorMonth, Min($BTC Discharge Date,$LastDayofPriorMonth));
var number DaysStoredPriorMonth = If(
IsNull($BTC Admission Date),0,
not IsNull($LastDayStoredPriorMonth), ToDays($LastDayStoredPriorMonth - $FirstDayStoredPriorMonth));
$DaysStoredPriorMonth
Sorry took longer than I thought-please know I do not expect a response...
I've been playing and ending up with syntax errors, I played around with the parenthesis... think that may have messed things up? I read and understand how the variable formula helps...
Here is what I did:
var date FirstDayofPriorMonth = AdjustMonth(FirstDayOfMonth(Today()),-1);
var date LastDayofPriorMonth = LastDayOfMonth($FirstDayofPriorMonth);
var date FirstDayStoredPriorMonth = If(
$BTC Admission Date <= $LastDayofPriorMonth and (IsNull $BTC Discharge Date or $BTC Discharge Date >= $FirstDayofPriorMonth),
Max($FirstDayofPriorMonth, $BTC Admission Date));
var date LastDayStoredPriorMonth = If(
IsNull($BTC Discharge Date) and not IsNull($FirstDayStoredPriorMonth), $LastDayofPriorMonth,
not IsNull($FirstDayStoredPriorMonth) and $BTC Discharge Date >= $FirstDayofPriorMonth, Min($BTC Discharge Date,$LastDayofPriorMonth));
var number DaysStoredPriorMonth = If(
IsNull($BTC Admission Date),0,
not IsNull($LastDayStoredPriorMonth), ToDays($LastDayStoredPriorMonth - $FirstDayStoredPriorMonth));
$DaysStoredPriorMonth