Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Our May 2021 end-to-end product release from Data Integration to Data Analytics is out! READ DETAILS
Showing results for 
Search instead for 
Did you mean: 

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

Hi, you can try with:

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