My data looks like this:
TagId Timestamp Value
23 2022-06-19T10:25:51.7229267Z 90
22 2022-06-19T10:25:51.7229267Z 90
21 2022-06-19T10:25:51.7229267Z 90
21 2022-06-19T10:30:51.7229267Z 90
22 2022-06-19T10:30:51.7229267Z 90
I want to aggregate it by hour, so I query like this:
T
| where Timestamp > ago(30d)
| where TagId in (21, 22, 23)
| summarize round(avg(todouble(Value)), 2) by bin(Timestamp, 1h), TagId
| order by Timestamp asc
The returned data looks like this:
Timestamp TagId avg_Value
2022-06-20T12:00:00Z 21 59
2022-06-20T12:00:00Z 23 59
2022-06-20T12:00:00Z 22 59
2022-06-20T13:00:00Z 23 58.08
2022-06-20T13:00:00Z 22 58.08
2022-06-20T13:00:00Z 21 58.17
Is it possible to combine "same" timestamps and instead create new columns for each TagId, so the returned data would be instead something like this:
Timestamp 21_avg_Value 22_avg_Value 23_avg_Value
2022-06-20T12:00:00Z 59 59 59
2022-06-20T13:00:00Z 59 59 59
2022-06-20T14:00:00Z 59 59 59
2022-06-20T15:00:00Z 58.08 58.08 58.08
2022-06-20T16:00:00Z 58.08 58.08 58.08
2022-06-20T17:00:00Z 58.17 58.17 58.17