Hi
Please review this document which might clarify how you can update this function to have matching aggregations in both numerator and denominator.