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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Filtering a column based on other columns through Expression

Hello Qlik Community,

I have a question about an expression I am trying to figure out to try and accomplish the following:

I have the data set below. My goal is to provide an expression so that if 'Date' and/or 'Code' differs for any one PatientID, then ONLY display those 'PatientIDs'.

PatientIDDateCode
57087/1/20161
57088/4/20161
12857/2/20162
12857/2/20163
21207/3/20163
84627/4/20164
84628/1/20168
30027/5/20165
10987/6/20166

So with the data set above:

1. PatientID# 5708 would be displayed since there are two different 'Date' records for the same PatientID.

2. PatientID# 1285 would be displayed since there are two different "Code' records for the same PatientID.

3. PatientID# 8462 WOULD NOT be displayed since even though it has 2 records, neither 'Date' nor 'Code' is repeated for that record.

As for the rest of the records, they should ideally not even show up on my straight table chart since there is nothing wrong with them (including 8642 since nothing is wrong with it).

Overall, if 'Date' and/or 'Code' differs for one PatientID, then I would like that PatientID to show up on my straight table chart. If 'Date' and 'Code' do not differ, then I do not want that record to appear on my chart.

I know this can be accomplished and have made some strides towards accomplishing this, using this expression: =if(aggr(NODISTINCT count(Date),PatientID,Code)>1,1,0). But this, however, still shows me the some records like 1098 in the chart above which is just a single record without anything wrong with it and the 8642 example where there is nothing wrong with the record according my condition, but it still shows up in my table.

Thanks in advance! This would be great help for me!

Best Regards,

Tej

   

10 Replies
Not applicable
Author

Thank you both for your help! I was able to get it to work on my end!