Query consumption/time based on another field (energy consumption per day when sun is down)

Thank you @grant2 ! Everything works up to the sum. I’ve tried lots of different things but I always get a 500 error (see screenshot). Do you have a clue what might be wrong?

I also had to use the keep to make pivot return everything in one row.