Get Number of Active Days for Average

Trying to develop some basic analytics and have a question on an average per day calculation. I have some template and history_stats sensors I created that give me total pump starts and total pump runtime for my septic pump for things like today, yesterday, last 7 days, and last 30 days. I would like to create a sensor that gives me average starts / day over the last 30 days (which is where I cut off my recorder history). This would be fine if there was 30 days of data and the value was just (total starts / 30), but since I just created these templates, the average would be really skewed. Essentially looking at just a few days worth of data divided by 30.

Is there a way to use history stats or something else to count number of days in a period where pump starts is >= 1? Then I could use that value in lieu of 30 for (total_starts / active_days)?

Or am I completely over-thinking this and there is a simple solution in front of my face?

Thanks.