Bar or doughnut grapg (with substract in MySQL table)

Hi folks,

I want to make a new bar graph/doughnut in Grafana.
Here you can see MySQL table structure: (every line is the end of a day)

The problem is that I need to substract KwhX1, KwhFV1,… from the previous line to know how many Kw has been generated/consumed by that day.

The results of these substracts (previous day from actual day) is the data to be shown in bar graphic.

Is this possible to do with Grafana? Can you help me if this issue is possible?

Thanks in advance.

Best Regards.

Pau