Add multiple Elasticsearch metrics for variable in single panel

I have a template variable setup $avgs which gives me [a1.avg, a2.avg, a3.avg]
My Elasticsearch records are structured like

    "a1": {
        "avg": 12
    "a2": {
        "avg": 24
    "a3": {
        "avg": 36

I need a query which shows sum of a1.avg, a2.avg, a3.avg when all option is selected.

If I select only a1.avg from dropdown, I am able to see graph, but cannot see multiple lines plotted if I have multiple/all selected.

when I select a1.avg from dropdown

when I select all from dropdown

I am pretty sure that my query is wrong, but did not find any resources on how to structure this query to show multiple metrics for multi valued variable.

PS: I already tried having multiple panels when multiple values are selected. But I want all of them in single panel.