Hello, I am designing a project through arduino that records real time power measurements in WATT and store those values in a local database each 10 seconds. I am confused that how can I calculate daily power consumption by using these values from the database...I get approximately 360 values each hour.

Right now the calculation that I have applied is "taking average of all power values of the day and multiplying them by the number of hours of usage"

P(total) in kWh = P(avg of all values of day) * T (no. of hours of usage) / 1000

Is this calculation perfect? Or rather than taking the avg of all the values do I have to add all the values and then multiply them by the total no. of hours of usage?

Help would be appreciated thank you.