How to sum daily usage to get monthly usage

I have an energy consumption sensor that provides daily readings in kilowatt-hours (KWh), and it resets at midnight each day. My goal is to aggregate the daily consumption data to track the total energy consumed for the entire month. Additionally, I want to align this monthly cycle from the 13th of one month to the 12th of the following month. How can I achieve this data aggregation and cycle synchronization?

First, create a forever increasing helper using the

Then, you can create all the utility meters you want that match your periods

Using the parameter offset to match the 12-13 constraint

offset:
  days: 12

offsetting 12 days will add 12 days to the first day of the month, so reset on the 13th.

Is it possible to use the sensor for values that are already running for several month?
This sensor is storing values for 2 years now. I would like to get the daily consumption from it.