Sorry, meant to reply at the time but was busy travelling.
I'm slightly surprised it works at all, as the gm variable is set during the definition of the test, not when it is run. But assuming that magically works somehow, you are running over corners, so you will have a waveform with the gm versus corners.
I would suggest you try doing something like:
at the end to see what the sweep names are - you will probably have to do a value(gm ...) to find the value at the value of one of the sweep variables to "slice" the data.
Or define the gm measurement as an output expression for the test?
Apologies for the quick (and untested) reply - I'm rather busy today.