in reply to if condition within module
the code attached is given by one of the monk, he helped me out.
Give credit where it's due - it was kevbot in Re: group by and sum for two columns.