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: 
Simon4
Creator
Creator

if statement not working correctly with dates

Hi all,

 

I have an If statement that is not working as desired. I have the following expressosion set named 'test':

 

IF(

	(DATE(DATEINWIP) <= DATE(vpeildatum)
    OR
    len(DATEINWIP) = 0)
    
    AND
    
    (len(DATEOUTWIP) = 0
    OR
    DATE(DATEOUTWIP) > DATE(vpeildatum))
    
    AND
    
    (date(DATEFINANCIALFINISHED) > vpeildatum
    or
    len(DATEFINANCIALFINISHED) = 0)
    
    , -1,0)

 

note : The variable vpeildatum is set to 6-12-2022

 

But the result is not correct:

Simon4_0-1670488079527.png

on the rows with DATEINWIP = 06-12-2022 the column test should always display -1 but it only works on the last row with 06-12-2022 . What could cause this?

Thanks in advance.

 

Kind regards,


Simon 

Labels (1)
3 Replies
vinieme12
Champion III
Champion III

add each of these conditions as seperate measures to verify which condition is failing,  

 

 (date(DATEFINANCIALFINISHED) > vpeildatum
    or
    len(DATEFINANCIALFINISHED) = 0)

 

(len(DATEOUTWIP) = 0
    OR
    DATE(DATEOUTWIP) > DATE(vpeildatum))

 

(DATE(DATEINWIP) <= DATE(vpeildatum)
    OR
    len(DATEINWIP) = 0)

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Simon4
Creator
Creator
Author

Simon4_0-1670488994007.png

The expression with DATEINWIP is failing.

 

Adding the seperate IF expressions the test expression is fully broken. How is this possible?

Simon4
Creator
Creator
Author

I changed the expression of DATEINWIP to :

(DATE(DATEINWIP-1) < DATE(vpeildatum)
OR
len(DATEINWIP) = 0)

 

Instead of using <= I just subtracted one day of DATEINWIP and used <. This works, but I am still wondeirng why the simple statement <= does not work.