Transformation, group by Date

Hi

Tried to group by my data im getting from mongodb.
I have got two Colums: timeseries and amount/sum.

For example:
“2021-08-31 15:36:15”, “10”
“2021-08-31 15:39:15”, “20”

Wanted to group it by day and sum the values per day for example
“2021-08-31”, “30”

I Made the following transformations but as you see didnt get any result as expected.

Can someone tell me where i did a mistake?

Do you want to add up all values for a given day? You can try the Transformation: Reduce → Total. You could display amount in a stat panel. You could also show the difference between the first and last value of a month by doing Reduce → Difference. Try some of these and see what you get.

2 Likes

Hello,
Exactly the same issue here (just a few hours later …)
Thx for your input, but in my case, it does not work


@thejorlock sorry for squat :-), but definitly the same issue (and need I guess)

1 Like

Does the amount 3180 (in the upper right corner of your screenshot) mean anything?

Hello,
“Almost” correct : 3180 is the sum for 19/11/2021.
But I’d expect to get to line 1 per date (in my case 2) and a correct Time (ie 19/11/2021 and not 16/07/2177…)

1 Like

Can you please share your query and also clarify what datasource you are using?

My datasource is InfluxDb and the query is “SELECT ELAPSED(“value”)/-1000000000 FROM “tvstat” where $timeFilter ORDER BY time DESC”

Same issue with a more simple query SELECT “value” FROM “tvstat” WHERE (“device” = ‘Tele’) AND $timeFilter

Thanks for advice.

But no. i dont want just a sum for alle timeseriesdata. I wanted to group the timeseries per day and get the sum per day.
Thought i could use “convert field type” but it seems that it doesnt convert it to the date format “YYYY-MM-DD”.

@sebastiencarecolin Have you tried inserting a GROUP BY clause in your query, such as select sum(value) from your_measurement WHERE $timeFilter group by time (1d)
I played around with the InfluxDB dashboard on play.grafana.org and you can group the data by day, hour, etc.

1 Like

Got a solution for me.

I changed the “query result” to “table” (instead of “timeseries”).

Then i did a transformation as see here to group the data by day

Maybe it helps other people getting in the same issue.

1 Like

@thejorlock, thx for the input does not work for influxDb data source :frowning:
Issue logged in github.
Wait & see