Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
archire2102
Partner - Contributor III
Partner - Contributor III

Comparing 2 date fields to flag the count

Hi,

I am trying to count the number of rows where Date1 is equals to Date2. It seems really simple but the flag has only 0 even if there are so many matching dates.

if(Date(Date#(Date1,'DD/MM/YYYY hh:mm'),'DD/MM/YYYY') = Date(Date#(Date2,'DD/MM/YYYY'),'DD/MM/YYYY'), 1, 0) As FlagField

4 Replies
Anonymous
Not applicable

You have time also in the Date1 field. Get rid of the time and then compare it should work.

archire2102
Partner - Contributor III
Partner - Contributor III
Author

Thanks Aadil but that's why I have used Date and Date# function but still not working.

sasiparupudi1
Master III
Master III

You have to remove the time component

If(Date(Floor(Date#(Date1,'DD/MM/YYYY hh:mm')),'DD/MM/YYYY') = Date(Date#(Date2,'DD/MM/YYYY'),'DD/MM/YYYY'), 1, 0) As FlagField


I suggest you to put the individual expressions into  2 text boxes and see if the formats are coming out as expected


hth

Sasi

pradosh_thakur
Master II
Master II

if(floor(timestamp#(Date1,'DD/MM/YYYY hh:mm')) = floor(Date#(Date2,'DD/MM/YYYY')), 1, 0) As FlagField

Learning never stops.