# Showing multiple sensors data on the same measurement

**URL:** https://community.influxdata.com/t/showing-multiple-sensors-data-on-the-same-measurement/27118
**Category:** Dashboards
**Created:** [October 24, 2022, 3:49pm UTC](https://community.influxdata.com/t/showing-multiple-sensors-data-on-the-same-measurement/27118 "2022-10-24T15:49:01Z")
**Posts on this page:** 19
**Page:** 1

<div class="post-metadata">

### Author: ![Mr\_Influx](https://avatars.discourse-cdn.com/v4/letter/m/85e7bf/32.png) [@Mr\_Influx](https://community.influxdata.com/u/Mr_Influx)
#### Post date: [October 24, 2022, 3:49pm UTC](https://community.influxdata.com/t/showing-multiple-sensors-data-on-the-same-measurement/27118/1 "2022-10-24T15:49:01Z")

</div>

Hello everyone,

I receive data from multiple sensors which are distributed in different places.  
As i’m not yet aware of how to use the Indluxdb2 dashboard, i store the data also on the old Influxdb 1.8v, and it looks like the following:

 ![image](https://us1.discourse-cdn.com/flex023/uploads/influxdata/original/2X/e/ed75fe7946d54bc75560353e90f22e993827f190.png)

my question is:  
How can i show the same data (the same way) on the influxdb2 dashboard without having to use the aggregation functions(as they cause errors with the names in red(strings)?

I would like to be able to download a CSV file with “Correctly tabled” data (not mixed measurements - like all the temperatures, measurements from all the places are stated together).

Thank you in advance.

---

<div class="post-metadata">

### Author: ![scott](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/scott/32/16492_2.png) [@scott](https://community.influxdata.com/u/scott)
#### Post date: [October 24, 2022, 4:43pm UTC](https://community.influxdata.com/t/showing-multiple-sensors-data-on-the-same-measurement/27118/2 "2022-10-24T16:43:06Z")

</div>

@Mr_Influx What’s your current InfluxQL query that you’re using to get this data?

---

<div class="post-metadata">

### Author: ![Mr\_Influx](https://avatars.discourse-cdn.com/v4/letter/m/85e7bf/32.png) [@Mr\_Influx](https://community.influxdata.com/u/Mr_Influx)
#### Post date: [October 24, 2022, 7:10pm UTC](https://community.influxdata.com/t/showing-multiple-sensors-data-on-the-same-measurement/27118/3 "2022-10-24T19:10:32Z")

</div>

Hello Scott, thank you for your reply, the influxQL query was:

\*\*

> use DataBase\_1  
> select \* from measur\_1 limit 50

\*\*

When i try to show the same data on the Influxdb2 dashboard, i get all the sensors data from all the sites mixed together, hence the graph doesn’t represent the real data of any of the sites.

 ![image](https://us1.discourse-cdn.com/flex023/uploads/influxdata/original/2X/8/8b0844748c937092cf7ca3a3a0b3df1f9871006c.png)

Kindly, i would like to know how i customize the query so I’m able to query a specific site or even better a specific sensor inside a specific site.

---

<div class="post-metadata">

### Author: ![scott](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/scott/32/16492_2.png) [@scott](https://community.influxdata.com/u/scott)
#### Post date: [October 24, 2022, 7:27pm UTC](https://community.influxdata.com/t/showing-multiple-sensors-data-on-the-same-measurement/27118/4 "2022-10-24T19:27:51Z")

</div>

Ok, thanks for the screenshot. It definitely helps identify the problem. Are you meaning to store `device_id` and ` ____ Name` as fields? I would expect these to be tags to get the data to graph they way you’re hoping.

---

<div class="post-metadata">

### Author: ![Mr\_Influx](https://avatars.discourse-cdn.com/v4/letter/m/85e7bf/32.png) [@Mr\_Influx](https://community.influxdata.com/u/Mr_Influx)
#### Post date: [October 24, 2022, 7:34pm UTC](https://community.influxdata.com/t/showing-multiple-sensors-data-on-the-same-measurement/27118/5 "2022-10-24T19:34:01Z")

</div>

honestly, i don’t know how to define their type as i send them from Node-Red as variables, but if converting them into tags would solve the problem then what should i do to make them tags?

---

<div class="post-metadata">

### Author: ![Mr\_Influx](https://avatars.discourse-cdn.com/v4/letter/m/85e7bf/32.png) [@Mr\_Influx](https://community.influxdata.com/u/Mr_Influx)
#### Post date: [October 24, 2022, 7:52pm UTC](https://community.influxdata.com/t/showing-multiple-sensors-data-on-the-same-measurement/27118/6 "2022-10-24T19:52:01Z")

</div>

I’m trying something like:

> from(bucket: “novabucket”)  
> |\> range(start: v.timeRangeStart, stop: v.timeRangeStop)  
> |\> filter(fn: (r) =\> r.\_measurement == “measur\_1” and r[“\_field”] == “\_Name”)  
> |\> filter(fn: (r) =\> r[“\_field”] == “humidity” or r[“\_field”] == “battv” or r[“\_field”] == “Temp”)  
> |\> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)  
> |\> yield(name: “mean”)

This script alone returns the same (mixed) data as in the screenshot above,  
however, once i add the condition(which is one of the sites names):

> and r[“\_sitename”] == “vi\_20d”

to the 1st filter, i get no graph, just “ **no result** ”

---

<div class="post-metadata">

### Author: ![scott](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/scott/32/16492_2.png) [@scott](https://community.influxdata.com/u/scott)
#### Post date: [October 24, 2022, 8:27pm UTC](https://community.influxdata.com/t/showing-multiple-sensors-data-on-the-same-measurement/27118/7 "2022-10-24T20:27:40Z")

</div>

There is information on writing values as tags in the [InfluxDB Node documentation](https://flows.nodered.org/node/node-red-contrib-influxdb#output-node). Setting “metadata” like device ID and name as a tag will make your data easier to query.

---

<div class="post-metadata">

### Author: ![Mr\_Influx](https://avatars.discourse-cdn.com/v4/letter/m/85e7bf/32.png) [@Mr\_Influx](https://community.influxdata.com/u/Mr_Influx)
#### Post date: [October 24, 2022, 9:23pm UTC](https://community.influxdata.com/t/showing-multiple-sensors-data-on-the-same-measurement/27118/8 "2022-10-24T21:23:22Z")

</div>

Thank you Scott, i started to search the documentation but i was confused about which section should i search (the word “tags” don’t have much) i’ll check what you suggested instead.

---

<div class="post-metadata">

### Author: ![scott](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/scott/32/16492_2.png) [@scott](https://community.influxdata.com/u/scott)
#### Post date: [October 24, 2022, 9:56pm UTC](https://community.influxdata.com/t/showing-multiple-sensors-data-on-the-same-measurement/27118/9 "2022-10-24T21:56:47Z")

</div>

Here’s some information about designing schemas for InfluxDB: [InfluxDB schema design | InfluxDB Cloud Documentation](https://docs.influxdata.com/influxdb/cloud/write-data/best-practices/schema-design/)

In the InfluxDB node (Node Red) documentation, you separate fields and tags in to separate objects as part of the output node payload array. The first object in the array is all the fields. The second object is all the tags associated with the point. Here’s the example they provide:

```javascript
msg.payload = [{
    intValue: '10i',
    numValue: 12,
    randomValue: Math.random()*10,
    strValue: "message2"
},
{
    tag1:"sensor1",
    tag2:"device2"
}];
return msg;

```

---

<div class="post-metadata">

### Author: ![grant1](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/grant1/32/15107_2.png) [@grant1](https://community.influxdata.com/u/grant1)
#### Post date: [October 24, 2022, 10:34pm UTC](https://community.influxdata.com/t/showing-multiple-sensors-data-on-the-same-measurement/27118/10 "2022-10-24T22:34:41Z")

</div>

Scott’s post above is exactly 100% correct. That is how I send data via Node-RED to Influx v2.3

@Mr_Influx post back if you get stuck. Also, create a test bucket first to make sure it works before using the “real” bucket.

---

<div class="post-metadata">

### Author: ![Mr\_Influx](https://avatars.discourse-cdn.com/v4/letter/m/85e7bf/32.png) [@Mr\_Influx](https://community.influxdata.com/u/Mr_Influx)
#### Post date: [October 25, 2022, 10:38am UTC](https://community.influxdata.com/t/showing-multiple-sensors-data-on-the-same-measurement/27118/11 "2022-10-25T10:38:21Z")

</div>

> [@scott](#):
>
> ```auto
> msg.payload = [{
> intValue: '10i',
> numValue: 12,
> randomValue: Math.random()*10,
> strValue: "message2"
> },
> {
> tag1:"sensor1",
> tag2:"device2"
> }];
> return msg;
> 
> ```

It’s much better now

 ![image](https://us1.discourse-cdn.com/flex023/uploads/influxdata/original/2X/6/6898a50afcd780a3c3af622cfdcb9e1535b7ea2d.png)

but as i don’t see any graph at the moment, i’m not sure if is it because the new data is too few or i should change something, i’ll wait 24h and try to get the mean curve.

1 last question, is it possible to modify the old data(not tagged) or I’ve to ignore it and start again?

Thank you so much Scott.

---

<div class="post-metadata">

### Author: ![Mr\_Influx](https://avatars.discourse-cdn.com/v4/letter/m/85e7bf/32.png) [@Mr\_Influx](https://community.influxdata.com/u/Mr_Influx)
#### Post date: [October 25, 2022, 10:51am UTC](https://community.influxdata.com/t/showing-multiple-sensors-data-on-the-same-measurement/27118/12 "2022-10-25T10:51:59Z")

</div>

Another question please, how i can rearrange the data based on the received time of influx?

 ![image](https://us1.discourse-cdn.com/flex023/uploads/influxdata/original/2X/d/d5b050d9770ac22cfaf89c10f0d498efa723e3b4.png)

I tried to use the function “sort” but i think it’s related to sorting the measurement values (the temperature in this case).

---

<div class="post-metadata">

### Author: ![scott](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/scott/32/16492_2.png) [@scott](https://community.influxdata.com/u/scott)
#### Post date: [October 25, 2022, 1:59pm UTC](https://community.influxdata.com/t/showing-multiple-sensors-data-on-the-same-measurement/27118/13 "2022-10-25T13:59:48Z")

</div>

> Is it possible to modify the old data(not tagged) or I’ve to ignore it and start again?

With the way the data was structured, unless every sensor sent data in at different times, there isn’t a way to accurately associate the field and tag values that should be tied together. I’m afraid you may just have to start again.

> How i can rearrange the data based on the received time of influx?

By default, InfluxDB returns data sorted by time. You shouldn’t need to re-sort the data. When you use the `sort()` function from the functions selector, it doesn’t actually let you set the column(s) to sort by and the default is `["_value"]`. This is why it appears to be sorted by value.

To help see that data as it is, don’t apply any aggregate function. If one is selected, deselect it. This will return your data as is without any aggregation or modification.

---

<div class="post-metadata">

### Author: ![Mr\_Influx](https://avatars.discourse-cdn.com/v4/letter/m/85e7bf/32.png) [@Mr\_Influx](https://community.influxdata.com/u/Mr_Influx)
#### Post date: [October 27, 2022, 6:45am UTC](https://community.influxdata.com/t/showing-multiple-sensors-data-on-the-same-measurement/27118/14 "2022-10-27T06:45:39Z")

</div>

> With the way the data was structured unless every sensor sent data in at different times, there isn’t a way to accurately associate the field and tag values that should be tied together. I’m afraid you may just have to start again.

I think i’ll start again, I’m keeping an additional version of the same data on the Influxdb 1.8, so maybe i can manipulate it and immigrate it to V2.

> To help see that data as it is, don’t apply any aggregate function. If one is selected, deselect it. This will return your data as is without any aggregation or modification.

But the platform doesn’t allow me to do that, every time i try to deselect the aggregation function, it complains like:

![image](https://us1.discourse-cdn.com/flex023/uploads/influxdata/original/2X/8/8137c5d5c2e66271fc70b3c480135cbfefed3ddf.png)

also for the “AUTO” for the aggregation functions, i can’t deselect them. I must choose one.

---

<div class="post-metadata">

### Author: ![scott](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/scott/32/16492_2.png) [@scott](https://community.influxdata.com/u/scott)
#### Post date: [October 27, 2022, 2:26pm UTC](https://community.influxdata.com/t/showing-multiple-sensors-data-on-the-same-measurement/27118/15 "2022-10-27T14:26:25Z")

</div>

> [@Mr\_Influx](#):
>
> But the platform doesn’t allow me to do that, every time i try to deselect the aggregation function, it complains like:
> 
> ![image](https://us1.discourse-cdn.com/flex023/uploads/influxdata/original/2X/8/8137c5d5c2e66271fc70b3c480135cbfefed3ddf.png)
> 
> also for the “AUTO” for the aggregation functions, i can’t deselect them. I must choose one.

I’m not seeing this behavior. What version of InfluxDB are you using? 2.4? This is the behavior I see in 2.4:

![Kapture 2022-10-27 at 08.24.40](https://us1.discourse-cdn.com/flex023/uploads/influxdata/original/2X/4/4f99a40ac6a0f37406b5f9e50d9a2d5aa12d1138.gif)

---

<div class="post-metadata">

### Author: ![Mr\_Influx](https://avatars.discourse-cdn.com/v4/letter/m/85e7bf/32.png) [@Mr\_Influx](https://community.influxdata.com/u/Mr_Influx)
#### Post date: [October 27, 2022, 5:15pm UTC](https://community.influxdata.com/t/showing-multiple-sensors-data-on-the-same-measurement/27118/16 "2022-10-27T17:15:45Z")

</div>

I’m running the InfluxDB v2.4.0 as a container inside the RPI, and the behavior for me is as i mentioned, in fact, this is the main reason why i was looking to change the data that contain strings as the aggregation functions(which must be applied in my case) throw an error for the strings data.

This is what happens when i try to deselect the mean box:

 ![image](https://us1.discourse-cdn.com/flex023/uploads/influxdata/original/2X/0/07b91b7226c6527f50017346e57a4e6aa060c302.png)

---

<div class="post-metadata">

### Author: ![scott](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/scott/32/16492_2.png) [@scott](https://community.influxdata.com/u/scott)
#### Post date: [October 27, 2022, 5:29pm UTC](https://community.influxdata.com/t/showing-multiple-sensors-data-on-the-same-measurement/27118/17 "2022-10-27T17:29:22Z")

</div>

Well that’s frustrating. With your current selection, just click **Script Editor** to switch over to the raw Flux query and delete the line with `aggregateWindow()`. That will return the data as it is.

---

<div class="post-metadata">

### Author: ![Mr\_Influx](https://avatars.discourse-cdn.com/v4/letter/m/85e7bf/32.png) [@Mr\_Influx](https://community.influxdata.com/u/Mr_Influx)
#### Post date: [October 27, 2022, 5:36pm UTC](https://community.influxdata.com/t/showing-multiple-sensors-data-on-the-same-measurement/27118/18 "2022-10-27T17:36:24Z")

</div>

Yes, this works

 ![image](https://us1.discourse-cdn.com/flex023/uploads/influxdata/original/2X/9/96610142b670aa6a763675f5dc3f103612162ab5.png)

but i must reselect all the tags and the fields and comment the line every time i want to check the data.

---

<div class="post-metadata">

### Author: ![scott](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/scott/32/16492_2.png) [@scott](https://community.influxdata.com/u/scott)
#### Post date: [October 31, 2022, 2:26pm UTC](https://community.influxdata.com/t/showing-multiple-sensors-data-on-the-same-measurement/27118/19 "2022-10-31T14:26:11Z")

</div>

> [@Mr\_Influx](#):
>
> but i must reselect all the tags and the fields and comment the line every time i want to check the data.

You can add this query as a cell on a dashboard and use the dashboard to view the data rather than going through the data explorer every time.
