Can you help a newbie convert a working Grafana InfluxdB Query into a CQ in influxdB

I am hoping to create daily integrations of my watts data to produce daily kilowatt hours. A single stat each day at 23:59:59.

In Grafana, I can query my influx database as in this screenshot and get the correct value. But when I attempt to translate this into a CQ in influxdb that would run once daily and precalculate daily kwh it says format is syntax correct but returned no results.

Can you help me learn the correct way to form this CQ?

EDIT: Apparently newer users can only insert one image so I will paste in here my attempt at a CQ to represent this in influxdb:

CREATE CONTINUOUS QUERY "daily_kwh_cq4" ON "homeassistant" BEGIN SELECT INTEGRAL("value")/3600000 INTO "homeassistant"."thirtytwodays"."daily_kwh_cq" FROM "homeassistant"."autogen"."W" WHERE ("entity_id" = 'pm_main_total_watts_2') GROUP BY time(24h) END