Energy: Previous year period comparison

I would like to have the possibility to compare not only a period with the previous period, but also with the previous year’s period.
I think on a daily, monthly and yearly basis this would be relatively easy to implement. You might have to take leap years into account, but the accuracy would be sufficient even without that, I think.
For calendar weeks, you could compare the corresponding period on a daily basis. Also here, from my point of view, the fact that the weekdays then do not match exactly would be to get over. Likewise the treatment of the weeks at the turn of the year.