# Using multiple queries in a formula to derive a new query

Hi All,

This is my first post in this community, so please forgive any rookie mistakes (but also please let me know!).

I have some queries from a prometheus ts data source and they properly display a sum of data in a given time window. But then I need to find a % value from those queries. The queries look essentially like this (labels and values have been changed to protect the innocent):

sum(rate(unique_value1{_domain=“somedomain”, identifier=“thisone”}[5m]))

For example: I have query A, B, and C. I need the value that comes from A / (A + B + C)

I have tried to do this right inline, such as:

sum(rate(unique_value1{_domain=“somedomain”, identifier=“thisone”}[5m])) / sum(rate(unique_value2{_domain=“somedomain”, identifier=“thisone”}[5m]))

This gives me a value

But this gives me nulls

sum(rate(unique_value1{_domain=“somedomain”, identifier=“thisone”}[5m])) / sum(rate(unique_value2{_domain=“somedomain”, identifier=“thisone”}[5m])) + sum(rate(unique_value3{_domain=“somedomain”, identifier=“thisone”}[5m])) + sum(rate(unique_value1{_domain=“somedomain”, identifier=“thisone”}[5m]))

I’ve also tried a query using A / (A + B + C), but that doesn’t seem to work.

I’ve tried using perens in different places to make it work and I’m having trouble finding any docs on how I should be approaching this.

I’m on Grafana 5.4.2

Thanks in advance for any help!

Have you solved this problem？