Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
dranjbar
Contributor III
Contributor III

Matching first part of Date fields while ignoring year

Hi All,

 

I'm looking for a way to match the first part of the xx/xx/1997 (ignoring the year field) with another field a like.

Essentially field 1 is a DOB and field 2 is an AppointmentDate.

Looking to create a formula which is if day and month match in both DOB and AppointmentDate (while ignoring the year), display name.

 

I've looking into a couple things like wild match but I can't see any of them matching my scenario.


Any help or guidance would be appreaciated here!

 

Labels (1)
3 Replies
sidhiq91
Specialist II
Specialist II

@dranjbar  I have taken some sample data and created your requirement. Please let me know if it has resolved your issue.

NoConcatenate
Temp:
Load * inline [
Name, DOB, Appointment Date
Sidhiq, 09/06/1991, 09/07/2013
Satish, 14/08/1990, 14/08/2013
Danish, 31/03/1991, 24/09/2013
Avinash, 22/11/1989, 22/11/2013
];

NoConcatenate
Temp1:
Load *,
if(trim(New_DOB)=trim([New Appointment Date]),Name,'No Match') as Match_Column;

Load *,
Date(Date#(DOB,'DD/MM/YYYY'),'DD/MM') as New_DOB,
Date(Date#([Appointment Date],'DD/MM/YYYY'),'DD/MM') as [New Appointment Date]

Resident Temp;

Drop table Temp;

Exit Script;

marcus_sommer

There are various possibilities, for example:

-(makedate(0, month(Date1), day(Date1)) = makedate(0, month(Date2), day(Date2))) as Flag

or maybe:

-(daynumberofyear(Date1) = daynumberofyear(Date2)) as Flag

- Marcus

MarcoWedel

some other expressions:

Month(DOB)=Month(AppointmentDate) and Day(DOB)=Day(AppointmentDate)

Left(DOB,5)=Left(AppointmentDate,5)

SetDateYear(DOB,Year(AppointmentDate))=AppointmentDate

Age(AppointmentDate,DOB)>Age(AppointmentDate-1,DOB)