Statistics to get value difference in the past 24 hours is 1 number off

I have been trying different statistics options, such as: change, count, distance_absolute, sum_differences but they are always one digit off. How can I get the values from the past 24 hours as shown on the chart below? I want 444-440= which should be 4, but HA keeps returning 3.