Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
skudera27
Contributor
Contributor

Calculated # of days when Null values are present

Hi All,

I have two columns of dates in my data

DateOfHire - each row has a date populated

DateOfTermination - some rows have dates, others do not

I am trying to make a calculated field that shows the number of days between 1) Hire and Termination, or if they are still employed, 2) Hire and Today's Date

My formula is setup as this:

If(DateofTermination = '', today() - DateofHire, DateofTermination - DateofHire)

It returns the number of days DateOfTermination - DateOfHire, but not when there is a null value in DateOfTermination and I try to use today's date instead.

Can someone help me understand what I'm missing to make this formula calculate properly? Thank you!

1 Reply
rubenmarin

Hi, you can try with:

If(Len(Trim(DateofTermination))=0, today() - DateofHire, DateofTermination - DateofHire)