How to convert timestamp and then group by date?

What I want is (for example) if my data came in like this:

Time                     |      Val
2022-05-12 20:50:00      |      1  
2022-05-12 20:55:00      |      2
2022-05-13 20:50:00      |      4
2022-05-13 20:55:00      |      10

I want it to be transformed to look like this, such that the it is grouped by Time (ignoring the time part of the timestamp), and summed on Val:

Time            |      Val
2022-05-12      |      3
2022-05-13      |      13

I have the following data table:

I added a data override, which successfully gets rid of the HH:MM:SS from the timestamp, and tried a ‘group by’, but it does not group any of the data.

I also tried converting the timestamp via a transform, which did not work:

How can I accomplish the the timestamp reformatting and the grouping?

not sure what your data source is so plugged it into infinity csv inline and using this

1 Like

This is using a prometheus data source. Glad that my commands weren’t wrong, but even the very first step of Convert field type isn’t working for me

I even tried renaming Time to time, in case that was causing some issue, and it did not work.

please provide sample data as json or whatever data type it is? cause I do not have Prometheus installed but can emulate it

Change your date format from YYYY-MM-DD to DD and then group by time and it should sum the totals for each day.

Use the bar chart

I tried reformatting the date and it did not work.
I need a table, not a bar chart.

Can you use the data tab inside the Grafana Inspector panel to share your data?

1 Like