Last Value from sum of metrics in GAUGE and TABLE

  • What Grafana version and what operating system are you using?
    Grafana v10.4.1
  • What are you trying to achieve?
    Get the LAST Value from metrics (the latest one)
  • How are you trying to achieve it?
    I’m trying to achieve the LAST (true) value from the sum of a couple of metrics at once (for example metric A and metric B has the last value and then I want to SUM up those LAST values.
  • What happened?
    A couple of the metrics are not showing values at all. Some of them display the wrong one.
  • Can you copy/paste the configuration(s) that you are having problems with?

I am sending data every 5 minutes (so I think I can’t use INSTANT as a Type).
In those 5 minutes, there are data with a whole 5 minutes range, but I have to wait every 5 minutes to send them.

More info:
I’m using Prometheus VM and my metric has a couple of metrics such as Destination, A, B, C, etc.

I chose Type in Options Format (TimeSeries) and instead of Range, I chose Instant to get the latest.

I used transformations:

  1. labels to fields (because I need one label as a value)
  2. Merge series/tables
  3. Group by (Time and one of my metrics) and all of my metrics are calculated as TOTAL
  4. Group by (the same metric as before but now for aggregating data on that label) this time my metrics are calculated as LAST
  5. And then I’m using “Add field from calculation” for summing up a couple of my metrics into one and rename it - Metric A, Metric B → Calculation TOTAL Alias = New One.

I think I wrapped up everything. I don’t understand what I’m doing wrong, but I don’t want to believe that is such a difficult task to achieve a table and gauge with the latest value.