Expression is not operated in grafana dashboard

I use Grafana v9.5.14. I am using HOST-RESOURCES-MIB::hrStorageUsed and HOST-RESOURCES-MIB::hrStorageSize for my virtual machine to see the used / size ratio. I have 2 queries, in query A, I have the storageUsed, and in query B, storageSize. For example, I used the query
|> filter(fn: (r) => r[“_field”] == “hrStorageUsed” or r[“_field”] == “snAgGblDynMemUtil”), for the storageUsed. And for the storaSize, the exact same manner used in query B, too.

In Grafana, however, when I try to operate an expression ($A / $B ) * 100 my dashboard is as follows:

Here, the values are not processed as a result of the expression above, but the exact storageSize values shown for each indexes. I need to see the ratio between them. I also want to note that there is also a physical system with another ip address added, which works fine. The mib is “FOUNDRY-SN-AGENT-MIB::snAgGblDynMemUtil”, the unit in percentage, so no need for calculation:

I also tried to use transform > add field from calculation. but the fields are not seem quite right because of many different hrStorageDescr fields. Is there a way to do the calculation?

I’ve found different methods to solve the problem. First is the using transformation:

1- Add field from calculation > Binary operation > Choose the correct operation between the fields as you wish. Then give an alias and mark Replace all fields. As far as you can’t do more than one operation for one binary operation, you are supposed to create the same steps for the next calculation, by using the alias you’ve just created.

2- However, this operation is not valid when you use more than one agent. Because when you add the other agent’s mib in the other query, the above operation can’t be calculated. Thus, we can edit the query to do the calculations, where you use the mibs, by creating pivot & map as a solution.

3- We also can use starlark processors inside Telegraf to manipulate data even before it is reflected into db. We can achieve the desired operation by using this solution.