Number of days calculation for admission and discharge fields

I am creating an app for a non-profit medical facility serving people experiencing homelessness. The organization needs two tracking data points:

  1. Total Days of Care to date

2)Total Days of Care Upon Discharge


I am have created calculations for both #1 and #2 but as you can see below, as the client is still a resident, the Total Days of Care Upon Discharge  shows a negative number, which is confusing to users. 


Calculation: (Updated_datetime - AdmitDate) / (60*60*24)


When the client is discharged, the Total Days of Care to date  field keeps counting the days which is different from the discharge date. Again, confusing for data reporting. 


Calculation: (DischargeDate - AdmitDate)  / (60*60*24)


I need a calculation that zero’s out (or leaves blank) the Total Days of Care Upon Discharge  field when the client is still a resident and then zero’s or blanks out the Total Days of Care to date  when the client has been discharged. 


Any ideas? 

Hi David,

For your case, the IF function might be a good option.
The IF function is a function that changes the value to display depending on the specified conditional expression.

IF Function: Changing the Value to Display Depending on the Condition:

Could you try this out and see if you can achieve the desired process?
Hopefully, it helps.

Hello Sean,

Tim at Kintone created the calculations for me, which solved my issue. 

Thanks for the input.