• That looks just fine, Jeff. The "pre-aggregation" method would add nothing here because each feeder only has one entry per hour (according to the data you've shown in your original post).

    As a bit of a sidebar, thanks for taking the time to dig into those two articles. A lot of people would rather have a solution provided on a silver platter rather than taking the time to teach themselves something new and then have great success at it. Well done and thank you for the feedback.

    EDIT: I missed the fact that you used FORMAT instead of CONVERT. It won't make much of a difference here because of the extremely low row count of how it's being used here BUT, be advised that FORMAT is 44 times slower than CONVERT. I'd recommend just staying away from FORMAT altogether. It's not worth getting into the bad habit of using it in it's current manifestation (or, infestation, if you prefer :-D)

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)