[MONDRIAN-1869] - avg measures need to be aggregated in SQL similar to distinct-count. You cannot aggregate avg from separate queries because the count for the denominator is lost by then.  cherry-pick from f1d5991
Merge pull request #321 from kurtwalker/MONDRIAN-1869-lag

Mondrian 1869 lag