Cut a Value from a Column in Grafana Table

Hi There,

I have data that I display using a table like below

on the timestamp column, I’m planning to change it from 2022-12-29 xx:xx:xx to 2022-12-29. is it possible? what transform i can use for it? i’m using Grafana 9.0.3 and elastic as data source

Thanks

You can use transformation

Convert Filed Type

Select @timestamp in Field choose time type and add YYYY-MM-DD when you do this your @timestamp will be 2022-12-29 00:00:00
but if you want to remove time completely you can use override to remove time like this

sssa

3 Likes

Thank you. I will try it first

Pada tanggal Kam, 29 Des 2022 16.51, Usama Altaf via Grafana Labs Community Forums <notifications@grafana.discoursemail.com> menulis:

okay, now the value is according to what you showed. but how to classify them? i want them all to be 1 row as they have the same date. if do this
image
the result is still same like before


how can i group those data based on date and bit3.keyword?
this is a picture of the table that I want to create
image
similar to this but there is a timestamp column

is that possible?

Thanks

What is your data source?

i use elasticsearch as data source. you can see more detail about what i use in my first post

group by timestamp and bit3.keyword also?

did you try to select something else like total or count in bit3.keyword let me know if this is grouping dates.

and are you using override to change date format or are you using convert field type?

can you show us your query/provisioning?

I wanted to display the total data per day and per channel id(bit3.keyword). I guess this is my plan
image

so i calculate bit4 and group them by timestamp and bit3 which is channel id
image

Initially, I thought that by changing the format of the date as you told me, I could group the data by date. but apparently not. do you think its possible.

This is my query

Thanks

I’ve tried your data myself and it is working for me please tell me if I am getting you wrong here because as I understand you exacctly wants this.

the json I am using for testing it is below:

{
  "value": [
    {
      "bit3.keyword": "600011",
      "bit4.keyword": "4588895",
      "timestamp": "2022-11-01 12:33:52"
    },
    {
      "bit3.keyword": "600011",
      "bit4.keyword": "4595",
      "timestamp": "2022-11-01 12:33:56"
    },
    {
      "bit3.keyword": "600012",
      "bit4.keyword": "4595",
      "timestamp": "2022-11-02 12:33:56"
    },
    {
      "bit3.keyword": "600012",
      "bit4.keyword": "4588895",
      "timestamp": "2022-11-02 12:33:52"
    }
  ]
}

yes, that is what i expected. but it doesn’t work for me

i’ve tried to create a new panel with same query but still doesn’t work

this should be enough right?

maybe it would be better if they have different timestamp at it’s time each other

Thanks

It is not working because of you have 2 channels on the same date 600001 and 600005 on 2022-12-30 so it will not work like this.

you can group it by date or channel I think so

Hope anyone else can help you who is familiar with the elastic search but you can do something like this but you don’t want in that way

OK, no problem. thanks for your help by the way

but I’m curious why the timestamp that I convert via transform doesn’t change?
image

do you have any insight?

Hi, it is very very good question:

why the timestamp that I convert via transform doesn’t change?”.

I have same issue in my grafana with elastic data source.

I think that it is bug, it doesn’t help to convert timestamp to string at first and add the second conversion to Time, because date will be totally different from original timestamp…

Anyway, is there any grafana’s expert who can help ? Thanks.

1 Like