Creating if statement to get the time in-between two dates, but if the need by date is NULL then I want to use The create date

hcsavage
Participant I

I have this so far. I want to find the number of days between the need by date and the receipt date, but if the need by date is NULL then I want to use the create date. What am I getting wrong? 

if(${orders.need_by_date}=null,diff_days(${orders.created_date},now()),diff_days(${orders.need_by_date},${receipts.receipt_created_date}))

0 2 483
2 REPLIES 2

adnanjmi
Participant I

In SQL you can’t equate to null instead you should write as ${orders.need_by_date} is null

Dawid
Participant V

And in the table calculation you need to use is_null() function

Top Labels in this Space
Top Solution Authors