Using this function (GetObjectMeasure(index)) you can get the first (index being 0) or second (index being 1) measure. It tells you the actual label string value. I then tried to get length since reference line requires a numeric value.
I renamed your first measure as ABCD and second as AB. I was hoping a simple IF condition can then be used to evaluate which one is selected.
It works in the Pivot Table but somehow not when evaluating in the reference line expression. Please let us know if you can experiment a bit more and get it working.