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

Last occurrence of value

Salam,

I wanna find last occurence of patient file number. I wanna know how many patients

by thier number were last seen 6 month ago or more.

my fields:

URN: is patient file number

Appointnment datetime: date and time.

 

Regards,

Labels (1)
2 Replies
daturpin
Partner - Creator II
Partner - Creator II

In a table?

You should only have to create a table, where one column is =[URN] and the second column is =Max([Appointment Datetime])

It will then give you one entry for each unique URN and the maximum associated timestamp.

avkeep01
Partner - Specialist
Partner - Specialist

In the script you could use: 

Table:
LOAD 
URN,
Appointnment
FROM Source; 

LEFT JOIN (Table) LOAD 
URN,
IF(DATE(MAX(Appointnment))<DATE(ADDMONTHS(TODAY(),-6),1) AS [Last seen in six months]
RESIDENT Table
GROUP BY URN;

 

Then you can use this set analysis in your expression for counting the number of URN 

SUM(Last seen in six months])