Avg sensor monthly

Hi!
I have a sensor that on midnight get a new value. I want to calculate the avg value of that sensor. Not just the last 30 days. I want the value for the current month.

I tried to use a helper (utility meter) but my sensor don’t start at 0 so therefore I get the first value wrong. I tried do use the utility meter with delta value. But when I update templates the utility meter increase with the current value. So I need some help here.

  • Can I setup att sensor that calculates the avg value of a sensor for the current month?