Resample Expression returning no data

Problem: When trying to use the Resample expression, no data is returned (removing this expression shows data is being pulled through without it)

Scenario: I have a number of smart plugs reporting power usage data and am trying to get the sum total of all values at any given time (trying to do this using a stacked graph). The challenge is that these devices provide updates values as they change (as well as a soft poll every minute) and therefore, to the best of my understanding, the data points don’t stack due to the time differance. I’ve included a simple example of the dataset below:

| Time                    | DeviceName | GroupName | PowerDraw |
| 2021-03-16 10:41:29:548 | Plug1      | Room1     | 42        |
| 2021-03-16 10:41:30:210 | Plug2      | Room1     | 8         |
| 2021-03-16 10:41:50:012 | Plug2      | Room1     | 10        |
| 2021-03-16 10:41:58:223 | Plug1      | Room1     | 35        |
| 2021-03-16 10:45:21:321 | Plug1      | Room1     | 40        |

Looking at the recently added Resample Expressions tool, it looks like this should do what I need by automatically sampling each device once for every timestamp and then fill in the gaps (specifically pad it using the last-known value as that would still be correct if no new value was received).

Below is the config without the expression:

Below is the config with the expression:

Am I doing something wrong or is this a bug of the new feature? If the latter, is there some other way I should be approaching this issue?

hello i think this is a bug, can anyone please confirm

I’m having the exact same problem, with the same sort of database (data pulled from mutiple sensors that don’t all have the same timestamps). The resample function seems great for this, but I can’t get it working.

@BlueOrbit did you manage to solve this?

Thanks everyone

Afraid not, haven’t found anything yet

@BlueOrbit , thanks replying to quickly.

Actually I found something in the meanwhile, it seems there is already an option built in grafana.

Since in my queries I had the intervals already aggregated, there is not need to use resample. At the right side of “Queries” there is a tab called “Transform”. There I could do basic arithmetic binary operations using the queries I had. As you can see below in the screen capture, I have 3 measurements I wanted to combine, so I made a first Transform/Binary operation to generate the output “Cons”, which I then used in the second binary operation for the final result “House Consumption (W)”. There is a toggle button below called “Replace all fields” that I used in the final transform that removes all other queries and operations leaving only this last one in the plot.

Hope this is helpful.