I know this has been asked time and again by people all over the net, but I can't for the life of me figure out why my solution isn't working.
I have a bunch of groups, and in each group's footer I have a running total which acts as a sub-total for that group. At the very bottom of the page, I have a running total which adds all these sub-totals together to give a grand-total. This all works great.
To the right of each sub-total (group footer), I have a formula field which calculates what proportion of the grand-total this sub-total represents.
i.e. if the Grand-total is 4, and the sub-total is 1, the formula field displays 25%.
The problem is that for each group in the report, the Grand-total hasn't yet been fully counted (until the last group), and so the percentages are being calculated against incomplete Grand-totals.
To combat this, I've tried using the WhilePrintingRecords;
function on my percentage formula fields to ensure that the sub-total percentages are not calculated until the 2nd pass of the report, by which time the Grand-total should be fully calculated.
WhilePrintingRecords;
If {@LoggedToday} > 0 Then
{#LoggedToday} / {#TotalLoggedToday} * 100
Else
0
It's not working though! It's literally had no impact what-so-ever :o(
Does anyone have any idea where I'm going wrong here?
Thanks.
Best Answer
Yes, you're using a running total to calculate a grand total.
Instead, I suggest creating a Crystal formula for your percentage, in the form:
Sum ({
numeric field}, {
grouping item}) % Sum ({
numeric field})