Apex chart: problems working with "difference" Transform

Hello!

I would like to know more about these three items in apex charts:

I will explain the context better with an Excel example. I have an accumulated energy meter, which sends me the accumulated energy every 5 minutes. To obtain the energy consumed in a certain time slot, simply work with differentials (instead of absolute values).

In this way, if, for example, you want the consumption that has occurred in a certain period of time, you simply have to subtract the values:

My question is whether this differential part can be done from the apex chart using the three fields that I mentioned previously and with the “transform” field in “difference”.

I’m trying it and some values don’t fit.

Best regards!

Try the “spread” function in the Aggregate option.

Thank you so much @George_Santiago !

And what do these fields do? I would like to understand what do these fields do, for applying better my several situations. Do you know where could I find documentation about them?

For another hand, I am going to explain better the current context.

This difference:

Is chosen by the user in thinger.io:

For that reason I do not understand at all the solution that you exaplained me.

Best regards!

In your capture, it appears that you are selecting ‘mean, difference.’ Have you tried ‘max, difference’? In this case, it will take the greatest value of each data chunk and create the difference with the previous value.

So, in this way, I understand that the process that it will do is:

1. Take the max value from 12:00 to 12:59 (in blue in below image): 30587.3
2. Take the max value from 13:00 to 13:59 (in yellow in below image): 30825.2

1. And then it will calculate 30825.2 - 30587.3 = 237.9

It is right because in this case we are working with differential values, not with absolute values. We are subtracting the accumulated value of 12:00 (which is the maximum value of the 12:00 segment) from the accumulated value of 13:00 (which is the maximum value of the 13:00 segment). And if you look at the graph, since it is for each hour, it is correct. We are extracting the consume in one hour.

But if you zoom in and look at the graph for example every 10 minutes (X axis), it does not perform that post-processing again. It continues to be the maximum differential value from before: every hour (237.9) and not every 10 minutes.

I do not know if I’m explaining myself well