Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rounding yields only zeros...

Status
Not open for further replies.

hallmg

Technical User
Dec 5, 2007
14
US
Crystal XI. Have these fields/formulas to calculate the number of rooms required for a building with a particular capacity:

CAPACITY
@MaxCapacity = CAPACITY * 0.95
@Rooms = @MaxCapacity / 15
@TotalArea = @Rooms * 60

And Group sum totals for each placed in the Group Footer.

...which all seems pretty simple and the values returned are accurate. For one group summary, for example, these results are returned:

CAPACITY = 35
@MaxCapacity = 33 (displayed rounding)
@Rooms = 2.22
@TotalArea = 133.00

But I don't want partial rooms. In other words, @Rooms = 2.22 should calculate to 120, not 133. I can display round the @Rooms just fine, but I want @TotalArea to reflect an even multiple of 60 square feet; so I assumed using the ROUND() function should do the trick:

@TotalArea = round(@Rooms) * 60

...should round @Rooms to 2 * 60 = 120

But it simply changes @TotalArea in both the Details and Summary to zero. In fact, it doesn't seem to matter where I try to use ROUND() in any formula, it changes the results to zero in both the details and group sums.

Why?

Merle
 
You say that these are group summaries, but your formulas appear to be detail level summaries. I can't recreate your issue, so I'm wondering whether you are showing your actual formulas.

-LB
 
Actual formulas as created (though sans braces, sorry. should've copy/pasted). Each is then placed in the Details section and a Summary for each one inserted in Group Footer 2. There is a Group 1, as well, but it's just a further grouping by Campus. I'll eventually want Summaries there as well, but wanted to get this working first.

Merle
 
There are no percentage signs used in any formula? If there were percents, the results could round to 0.

-LB
 
No percentage signs in any formula.

Just for kicks, I started afresh, created a new report from blank, created the same formulas with the same result.

I won't go into everything else I've tried that didn't make a difference, but I did try modifying @Rooms:

@Rooms = @MaxCapacity / 0.15 (instead of 15)

...and all the rounded formulas bump up by a factor of 100:

@Rooms = 221.67
@TotalArea = 12,600

So, it's like the numbers in my original formula are just too small and it's rounding them down to zero and then adding up all the zeros.

Merle
 
Please show the actual content of all formulas and also show sample values for each field used in the formulas--show how the fields would display if placed in the detail section.

-LB
 
@MaxCapacity = {Command.CAPACITY} * 0.95
@Rooms = {@MaxCapacity} / 15
@TotalArea = {@Rooms} * 60

At Detail level with CAPACITY = 1:

@MaxCapacity = 0.95
@Rooms = 0.06
@TotalArea = 3.80

(CAPACITY is always 1 or greater in this report)

If I change:

@TotalArea = Round ({@Rooms}) * 60

Then @Rooms becomes zero (which makes sense, actually, since it's 0.06 at the detail level).

At the Group level, each formula is a SUM of the detail.

These samples BEFORE rounding:

CAPACITY = 53.00
@MaxCapacity = 50.35
@Rooms = 3.36
@TotalArea = 201.40

CAPACITY = 29.00
@MaxCapacity = 27.55
@Rooms = 1.84
@TotalArea = 110.20

CAPACITY = 173.00
@MaxCapacity = 164.35
@Rooms = 10.96
@TotalArea = 657.40

So, what I want to show is a rounded summary at the Group level for both @Rooms and @TotalArea. The above examples would be:

@Rooms = 3
@TotalArea = 180

@Rooms = 2
@TotalArea = 120

@Rooms = 11
@TotalArea = 660

Thanks!

Merle
 
So you should be creating formulas, instead of inserting sums:

round(sum({@Rooms},{table.groupfield}))

//etc.

-LB
 
Thank-you! That does the trick. Not one I've had to do before.

I appreciate your patience and assistance.

Merle
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top