The dev team doesn't know of a way to do this within VA's expression editor.
You could precalculate the top-two values by using the topK CAS action, or you could use PROC RANK or PROC SUMMARY. Here is a blog post that might be helpful.
Let us know if you get something to work for you!
I created a feature request for this. It would be great if you could specify "by-group" as the context for a rank on a Ranks panel.
Sam
... View more