Also note that you can use TOTAL(...) rather than COALESE(SUM(...),0). TOTAL is the same as sum except that it always returns a double with a default value of 0.0.
Also note that you can use TOTAL(...) rather than COALESE(SUM(...),0). TOTAL is the same as sum except that it always returns a double with a default value of 0.0.