• you do not actually need the derived table logic.

    you could do the math as part of the aggregated select if you wanted as well.

    I was hoping the derived table just made it more understandable.