Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
carolin01
Luminary Alumni
Luminary Alumni

if formula in script

Hi,

I Need some quick help. It´s stupid but I can just not see my error in my formula here:

if(Status = 3,
if(floor(ConfirmedReceiptDate = '01.01.1800',((floor(ReceiptDate2)) - (floor(PlannedReceiptDate)),
((
floor(ReceiptDate2)) - (floor(ConfirmedReceiptDate))))))) as OnTimeDeliveryInDays,

Staring at this for a lot of time now I´m sure it´s quicker to get some help from somebody here 🙂

Best regards

Carolin

1 Solution

Accepted Solutions
marcus_malinow
Partner - Specialist III
Partner - Specialist III

Hi Carolin,

try this:

if(Status = 3,
if(floor(ConfirmedReceiptDate) = '01.01.1800',(floor(ReceiptDate2)) - (floor(PlannedReceiptDate)),
((
floor(ReceiptDate2)) - (floor(ConfirmedReceiptDate))))) as OnTimeDeliveryInDays,

Marcus

View solution in original post

6 Replies
marcus_malinow
Partner - Specialist III
Partner - Specialist III

Hi Carolin,

try this:

if(Status = 3,
if(floor(ConfirmedReceiptDate) = '01.01.1800',(floor(ReceiptDate2)) - (floor(PlannedReceiptDate)),
((
floor(ReceiptDate2)) - (floor(ConfirmedReceiptDate))))) as OnTimeDeliveryInDays,

Marcus

alexandros17
Partner - Champion III
Partner - Champion III

Try this

=if(Status = 3,
if(floor(ConfirmedReceiptDate) = '01.01.1800',floor(ReceiptDate2) - floor(PlannedReceiptDate),
floor(ReceiptDate2) - floor(ConfirmedReceiptDate)
)
) as OnTimeDeliveryInDays,

marcus_sommer

Here is a missing bracket behind the date-field:

floor(ConfirmedReceiptDate = '01.01.1800'

Also there are too many unnecessary brackets around floor and the subtraction - this is only confusing.

- Marcus

carolin01
Luminary Alumni
Luminary Alumni
Author

Thank you, this was perfect for copy and paste 🙂 I knew it had to do with the brackets but I couldn´t see it anymore...

its_anandrjs

Hi,

Try this expression

if(Status = 3
And
floor(ConfirmedReceiptDate) = '01.01.1800',

(
floor(ReceiptDate2) - floor(PlannedReceiptDate)),
(
floor(ReceiptDate2) - floor(ConfirmedReceiptDate))) as OnTimeDeliveryInDays

Or

if(Status = 3,
if(floor(ConfirmedReceiptDate) = '01.01.1800',

(
floor(ReceiptDate2) - floor(PlannedReceiptDate)),
(
floor(ReceiptDate2) - floor(ConfirmedReceiptDate)))) as OnTimeDeliveryInDays


Regards

Anand

reshmakala
Creator III
Creator III

Try this:

if(Status = 3,

if(floor(ConfirmedReceiptDate) = '01.01.1800',floor(ReceiptDate2) - floor(PlannedReceiptDate),

(floor(ReceiptDate2) - floor(ConfirmedReceiptDate)))) as OnTimeDeliveryInDays