Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
brentski
Contributor III
Contributor III

Calculating Readmissions--SQL Subquery like function?

I am back again with more help with fundamentally trying to understand how Qlik Sense works

I work in a hosted environment and only have access to the frontend no ability to load additional data or add flags.

What I am trying to do:  Grab the First Person and Date Combination and Compare it to the Same person with a different date.

Sample Data

Person Identifier      Service Date      Type of Service

Person A                              1/1/21              Admission

Person B                              1/7/21              Admission

Person A                              1/22/21            Admission

Person A                               1/27/21           Primary Care Visit

Person B                              2/14/21            Emergency Visit

Person A                               2/7/21             Admission

Person B                               2/14/21           Admission

 

SQL would look something like:

select Person_Identfier, service_date, type_of_service from claims a, (select distinct person_identifier, min(service_date) as min_service_date from claims where type_of_service='Admission') b

where a.person_identifier=b.person_identifier and a.service_date between b.min_service_date and b.min_service_date+30 and a.type_of_service='Admission'

 

Expected Results:

Person A                              1/1/21              Admission

Person A                              1/22/21            Admission

Person B                              1/7/21              Admission

How do I get Qlik Sense to Grab a Person and that Person's minimum (or maximum date) then use that as the selection criteria for all People and Date combinations

Labels (4)
0 Replies