Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
baylor2016
Creator
Creator

set analysis question!

Dear expert,

I need to show the last lab result from all the departments for patients in department 1, but I only want the patients from dept 1 appear in the list. The problem is that when no filter in the last test results column, the dept 2 patients show up in the straight table. Not sure how to solve this problem. For example, patient 1's last lest (7.7) is done in dept 2, it is what I need, but I do not want patients 8,9 10 in the list since they are from department 2

Please help. Sample project attached

Thanks in advance

stalwar1

Longmatch

   

EncounterIDPatientIDDeptIDFCMYNA1CVisitDate
111112.61/1/2017
2111131/2/2017
311111.91/3/2017
41217.71/4/2017
521112.81/5/2017
6211131/6/2017
72119.11/7/2017
831110.31/8/2017
93116.21/9/2017
1032111.61/10/2017
11411141/11/2017
124119.41/12/2017
1341113.71/13/2017
145117.71/14/2017
1551114.91/15/2017
1661171/16/2017
176117.11/17/2017
187115.91/18/2017
1971110.91/19/2017
207115.41/20/2017
218228.91/21/2017
2282212.51/22/2017
238228.51/23/2017
2491211.61/24/2017
259126.91/25/2017
269125.61/26/2017
2710228.11/27/2017
28102210.1

1/28/2017

   

PatientIDFCMYNVisitsLastVisitLastA1C
201/20/201710.1
1141/4/20177.7
2131/7/20179.1
3131/10/201711.6
4131/13/201713.7
5121/15/201714.9
6121/17/20177.1
7131/20/20175.4
820-8.5
920-5.6
1020-10.1
1 Solution

Accepted Solutions
ahaahaaha
Partner - Master
Partner - Master

Hi,

If I understand you correctly, then we need to cut off patients with observations only in department 2. Then the sum of possible unique values of FCMYN should not be 2 (1 - only department1, 2 - only department 2. 3 - patient was in two departments).

An example in the attached file.

Regards,

Andrey

View solution in original post

5 Replies
NZFei
Partner - Specialist
Partner - Specialist

Check attached file please.

baylor2016
Creator
Creator
Author

Hi Fei,

Thank you very much for your helps.

I am sorry I did not state my questions clearly and the sample is not appropriate. I just modified the sample. My questions is I want to show ALL A1C values for all patients whose FCMYN=1. For example, patient 1's last test result on 1/4/2017  is 7.7 done in dept 2. I cannot use filter FCMYN =1 since it will filter out the test in FCMYN=2. I also do not want patient 8,9 10 in the list since they are from department 2.

ahaahaaha
Partner - Master
Partner - Master

Hi,

If I understand you correctly, then we need to cut off patients with observations only in department 2. Then the sum of possible unique values of FCMYN should not be 2 (1 - only department1, 2 - only department 2. 3 - patient was in two departments).

An example in the attached file.

Regards,

Andrey

baylor2016
Creator
Creator
Author

What I want to get is the latest test results for patients whose FCMYN=1, no matter where the test is done. However your answer is correct. I do not understand this syntax-Sum (DISTINCT TOTAL <PatientID> FCMYN) <>2. Can you explain? Thanks

NZFei
Partner - Specialist
Partner - Specialist

Hi,

I think the problem is that when a patient is showing in both Dep1 and 2, how do you know if he BELONGS TO Dep1 or 2?  It could be possible that a patient from Dep2 also has some result in Dep1, right? Then how can we know that this patient is belongs to Dep2 and not 1?

I know this is just some sample data. In your real full data, you may have Dep3 or more. We can hard code to make it work for now for just two departments but for your real full data, it is better to clearly define the rules. Maybe somehow load another field to define the patient department (not the department that the tests are done but the department that the patients belong to)?


I think your first sample app makes sense to me. There are both TestDepID and the FCMYN in that sample. And I think my first reply is the right answer (so for patient1 the last visit is 1/04/2017 and the result is 7.7). What is the problem for that?


" I cannot use filter FCMYN =1 since it will filter out the test in FCMYN=2". This is not right, using FCMYN=1 will NOT filter out the test in FCMYN2 when you have TestDepID because the "test in FCMYN=2" is in TestDepID=2, not FCMYN=2.


Hope this can help.

Cheers.

Fei