# Group data and set tag name as value name

**URL:** <https://community.grafana.com/t/group-data-and-set-tag-name-as-value-name/145502>\
**Category:** InfluxDB\
**Tags:** influxql, bar-chart\
**Created:** [March 4, 2025, 3:03pm UTC](https://community.grafana.com/t/group-data-and-set-tag-name-as-value-name/145502 "2025-03-04T15:03:53Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![moselwiese](https://avatars.discourse-cdn.com/v4/letter/m/3bc359/32.png) [@moselwiese](https://community.grafana.com/u/moselwiese)\
**Post date:** [March 4, 2025, 3:03pm UTC](https://community.grafana.com/t/group-data-and-set-tag-name-as-value-name/145502/1 "2025-03-04T15:03:53Z")

</div>

Hello,

I’m using Grafana 11.5.2 and I am currently facing issues with plotting GPS data. I am using InfluxDB as datasource.  
My database provides grafana with values, which I want to have separated based on there frequency band (L1, L2, L5).

 ![table view](https://us1.discourse-cdn.com/grafana/original/3X/3/a/3a2726fd7dd66a2468eeec5fba90f0be4a39d0c9.png)

I already tried to group these values based on their “freq” tag as you can see in the image below, but the name of the value will still be CN0, so when plotting the bar diagram the legend only shows CN0 three times.

 ![table view with transformation](https://us1.discourse-cdn.com/grafana/original/3X/f/0/f0e5cbf30b1a9431aab219da934d9f96b4bb73e4.png)

I want the value name changed based on the “freq” tag. Is that possible or is there a workaround for that?

Thank you!

---

<div class="post-metadata">

**Author:** ![moselwiese](https://avatars.discourse-cdn.com/v4/letter/m/3bc359/32.png) [@moselwiese](https://community.grafana.com/u/moselwiese)\
**Post date:** [March 6, 2025, 1:42pm UTC](https://community.grafana.com/t/group-data-and-set-tag-name-as-value-name/145502/2 "2025-03-06T13:42:47Z")

</div>

I have found a solution without the “Group by Matrix” transformation by setting up three different queries, each selecting values with the specific tag (L1, L2, L5) and combining them using the “Merge Series/Tables” transformation.

 ![CN0 values with different timestamp](https://us1.discourse-cdn.com/grafana/original/3X/f/2/f2fd0de385e4706ae3d318bfb2f8a9985c6e5dd0.png)

However, I now have the problem that I only want to display the CN0 values with the same last timestamp. I know I could enter a query option with relative time, but I want a more flexible solution that is not dependent on the refresh rate of my database.  
In this example, I only want to see the values with the timestamp (2025-03-06 13:36:54.000).

Is there a solution to that?

---

<div class="post-metadata">

**Author:** ![grant2](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/grant2/32/42281_2.png) [@grant2](https://community.grafana.com/u/grant2)\
**Post date:** [March 6, 2025, 2:04pm UTC](https://community.grafana.com/t/group-data-and-set-tag-name-as-value-name/145502/3 "2025-03-06T14:04:09Z")

</div>

Hi @moselwiese  
Does adding this Transformation help?

 ![image](https://us1.discourse-cdn.com/grafana/original/3X/7/3/733fa78017494e00738b9adf8a4d27fd1415cbcf.png)

---

<div class="post-metadata">

**Author:** ![moselwiese](https://avatars.discourse-cdn.com/v4/letter/m/3bc359/32.png) [@moselwiese](https://community.grafana.com/u/moselwiese)\
**Post date:** [March 6, 2025, 2:09pm UTC](https://community.grafana.com/t/group-data-and-set-tag-name-as-value-name/145502/4 "2025-03-06T14:09:29Z")

</div>

Hi @grant2,

thanks for your answer. This will only show the last value, in my example G20: L1. The other values with same timestamp are filtered out.

---

<div class="post-metadata">

**Author:** ![grant2](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/grant2/32/42281_2.png) [@grant2](https://community.grafana.com/u/grant2)\
**Post date:** [March 6, 2025, 2:17pm UTC](https://community.grafana.com/t/group-data-and-set-tag-name-as-value-name/145502/5 "2025-03-06T14:17:27Z")

</div>

Hmmm…I think this is possible with a series of transformations (filter by common timestamp?). I’ll mull it over and post back if I can come up with something, or someone else here can chime in and save the day.

---

<div class="post-metadata">

**Author:** ![moselwiese](https://avatars.discourse-cdn.com/v4/letter/m/3bc359/32.png) [@moselwiese](https://community.grafana.com/u/moselwiese)\
**Post date:** [March 6, 2025, 3:41pm UTC](https://community.grafana.com/t/group-data-and-set-tag-name-as-value-name/145502/6 "2025-03-06T15:41:23Z")

</div>

It works with the transformation ‘Partition by values’ but I’ve already seen some bugs when plotting the data. I guess it’s because it is still in the development phase.

 ![image](https://us1.discourse-cdn.com/grafana/original/3X/0/3/03c3b9a7a0feb61b117832165e541e0f4aea0cdb.png)

If you have any other suggestions please let me know!

---

<div class="post-metadata">

**Author:** ![moselwiese](https://avatars.discourse-cdn.com/v4/letter/m/3bc359/32.png) [@moselwiese](https://community.grafana.com/u/moselwiese)\
**Post date:** [March 7, 2025, 8:03am UTC](https://community.grafana.com/t/group-data-and-set-tag-name-as-value-name/145502/7 "2025-03-07T08:03:42Z")

</div>

I have a found a final solution now:

 ![image](https://us1.discourse-cdn.com/grafana/original/3X/0/4/046ab4ccaa8d44477456ef64ef0af073f8a4eec3.png)

First I sort by time (in reverse) to have the latest timestamp at the top. Then the ‘Partition by values’ transformation, which splits my data into blocks, with the current block being the one with the most recent timestamp. Finally, I sort by satellite name again to make the panel look nicer.

I hope this helps anyone!
