How to use dynamically a custom key/value ariable

Let’s say I have a variable Currency which is derived from a prometheus query, which I can use to filter the dashboard. For this example let’s assume it contains [USD, EUR, CHF, YEN]

Then there is a second variable Rates of type custom which contains these key/value pairs: [USD:1.0, EUR:0.8, CHF:0.9, YEN:105.0]. This variable is set to hidden, because I don’t want it to be used as filter.

Now the question is, how can I use the Rates variable within a query?

  • account_balance{account="Bank", symbol="$Currency"} * ${Rates:$Currency} or
  • account_balance{account="Bank", symbol="EUR"} * ${Rates:EUR}

If this does not work, is there a way if I define the rates as separate variables so I can access them dynamically?

  • account_balance{account="Bank", symbol="$Currency"} * ${$Currency}

Kind regards
Danny