Influxdb/grafana - difference kWh from IoTaWatt - vs calculated from Watt

Can you provide more context? I see this is a three-phase system. Is there a three phase inverter?
Looking at the Export calculation, what are you trying to do? The first part should compute the sum of all of the positive phases. Then you subtract the sum of all of the phases. Are you trying to get the absolute value of the sum of the negative phases?

There is a problem with trying to calculate these mixed sign numbers with the IotaWatt scripts. When you run a script, it operates on the net value of the data over the requested time interval. When you integrate the data over the interval with grafana, you get the sum of those values for each of the ten second measurements in the interval. Those may sound like the same thing, but they are not.

For simplicity sake, lets just deal with a single phase. Lets say the 10 second values over a minute are:

100, -60, -25, -40, 30, 70

The algebraic sum is 75.

If you upload these to grafana with the script: Watts = (fase min 0) abs
you will upload 0, 60, 25, 40, 0, 0 and summing them in grafana you will get 125. Yet if you ask IoTaWatt for the value of that same function for that minute, you will get 0 because the data is the algebraic sum of 75 which processes to 0 in the script.

Take a look at this Tracking separate solar Feed In Tariff