Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

pascaldijkshoor
Contributor

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
b_knuever
Contributor III

Re: if statement (Date=Date)

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

3 Replies
b_knuever
Contributor III

Re: if statement (Date=Date)

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

pascaldijkshoor
Contributor

Re: if statement (Date=Date)

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
Valued Contributor

Re: if statement (Date=Date)

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.

Community Browser