Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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'.
| PatientID | Date | Code |
| 5708 | 7/1/2016 | 1 |
| 5708 | 8/4/2016 | 1 |
| 1285 | 7/2/2016 | 2 |
| 1285 | 7/2/2016 | 3 |
| 2120 | 7/3/2016 | 3 |
| 8462 | 7/4/2016 | 4 |
| 8462 | 8/1/2016 | 8 |
| 3002 | 7/5/2016 | 5 |
| 1098 | 7/6/2016 | 6 |
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
Thank you both for your help! I was able to get it to work on my end!