Hi Mika I dont have the exact code with me at the moment. It was similar to this...
SELECT
Field1
,Field2
,SUM(
SUM(CASE WHEN Field3 IS NOT NULL OR Term - @WeeksPassed > 0 THEN 0 ELSE 1 END))
/
SUM(CASE WHEN Field4 IS NOT NULL OR Term - @WeeksPassed > 0 THEN 0 ELSE 1 TotalPaid END))
)
FROM
Table1
GROUP BY
Field1
,Field2
The idea is to get a total of how many Term - 20's are over 0 which were representing a loan term. Anything less than 0 would mean it has gone over term and should not be counted. This was to be divided by the sum of total paid to calculate performance. Please excuse the SQL code if it is full of errors as I am 250 miles from home and have no way of testing if it is right. :sigh: Thanks