One more try now that I got someone helping...
SSNs may have more than one discharge per day.
The full criteria would be discharge date desc, admit date desc
If those overlap the order is not important.
Basically I am looking at readmission data for a hospital network across the US.
Thanks for your help. I come from a T-SQL & Oracle background so your help is very appreciated.
Ok, so try this:
if(SSN = Previous(SSN), peek('Rank',-1)+1, 1) as Rank
ORDER BY SSN, Disday desc
I didn't add in the admit date -- you can do that. Example attached.
autoSequence-2.qvw 148.2 K