I just configured it through the UI at Integrations > Helpers > Create Helper then selecting the History helper.
More info here - History Stats - Home Assistant
I used these for the start and end times which I put in my original post:
Daily - start: {{ now().replace(hour=0).replace(minute=0).replace(second=0) }}
Weekly- start: {{ today_at('00:00') - timedelta(days=now().weekday()) }}
Monthly - start: {{ today_at('00:00').replace(day=1) }}
All - end: {{ now() }}