Skip to Content
0
Jul 06, 2020 at 04:42 PM

Rounding problem in Calculated Member of crosstab

41 Views

I have a crosstab with calculated members that creates an average. The problem is it always rounds down. So, if the average is 3.8, it will display as "3". I would prefer it to round to 1 decimal.

However, even when changing the formatting of the field to round to 1 decimal place, it just adds zeros (3.0).

I assume it may be related to my average formula that uses a crosstab value which is a "count".

Any advice how I could change this formula, to fix this rounding issue? Thanks!

local numbervar i; local numbervar avg; local numbervar cnt;

for i := 1 to CurrentColumnIndex-1 do ( avg := avg + GridValueAt(CurrentRowIndex, i, CurrentSummaryIndex); cnt := cnt + 1; ); (avg+GridValueAt(CurrentRowIndex, 0, CurrentSummaryIndex))/(cnt+1);