• Heh,

    After SQL Server Central published the article, I found this really good reference on Custom Rounding:

    http://support.microsoft.com/kb/196652

    In the end of the page there are examples, and the SymArith function does exaclty what my rounding function does, just that it avoids a Div by 0 on a 0 number, and additionally, does not require the Excel functions to be available on the server. The actual code in MDX is:

    Fix([Measures].[???] * Factor + 0.5 * Sgn([Measures].[???])) / Factor

    Where Factor is the rounding factor - 1 for 0 decimal places, 10 for 1 and so on (defined by 1/Factor).

    Of course, Factor of 0 will give us Div by 0 error and for truncation we can just use the truncation function in my article.

    Furthermore, Chris Webb advises that if you have the Excel libraries installed on your server, you can just use Excel!Round() instead of the function I've provided (it requires Excel to be installed, as it uses Ceiling).

    It is kind of bad that I did not include all this in the main article and I will ask SQL Server Central admins to include it as it is a definite miss.