sort complex metrics with groupby