Conditionally divide based on metric label

  • What Grafana version and what operating system are you using?
    v8.4.5

  • What are you trying to achieve?
    I am performing a group by divide operation on selectors based on a label which we will call “name”. Depending on the value of the label, I would like to divide it by a different number. For example:

if name == 2: divide by 2
elif name == 3: divide by 3
else: divide by 4
  • How are you trying to achieve it?
    My current query looking something like this:
min by (money) (selector_of_people) 

and I want to be able to do something like:

(min by (money) (selector_of_people)) / (vector(2) if name == "bob" or vector(3))

Any help would be greatly appreciated!