Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
pascaldijkshoor
Creator
Creator

if statement (Date=Date)

Hello,

I have two date fields: ACTIVITY_START and ACTIVITY_END with the fomat DD-MM-YYYY HH-MM-SS XY.

I want to make an if statement in the load script/data manager that calculates if the start and end activity happen at the same date. I have tried the formula:

- if (date (ACTIVITY_START) = date(ACTIVITY_END),0,1)

This did not work because the result was only 0 if both date fields were exactly the same, so the time had to be the same as well.

After this did not work I made two new date fields with the following formula:

date(ACTIVITY_START,'DD-MM-YYYY') AS START_DATE

date(ACTIVITY_END,'DD-MM-YYYY')  AS END_DATE

And i tried the following formula:

if (START_DATE = END_DATE,0,1)

This same problem occurred, that the times had to be the same as well.

Has anyone a solution for me?

Thanks in advance

1 Solution

Accepted Solutions
bramkn
Partner - Specialist
Partner - Specialist

If you floor(Date) the timestamp will be removed.

View solution in original post

3 Replies
bramkn
Partner - Specialist
Partner - Specialist

If you floor(Date) the timestamp will be removed.

pascaldijkshoor
Creator
Creator
Author

Then i got the numerical value of the datefield right? So this means the date and time have to be exactly the same as well.

dwforest
Specialist II
Specialist II

the integer part (Floor()) is the date and the value to the right of the decimal is time, so Flooring the values will compare the dates.

Be sure that the date format set matches the dates you are loading or Qlik may not recognize them as dates.