Calculations in Report Builder

I am going crazy over a calculation I am trying to do in Report Builder.

I have a database that records weather details each day. I want to calculate average temperatures and the like, and put this into the footer.

The function RecordCounter counts records correctly. The function AccumulationLOWreport sums the daily minimum temperatures. This seems to work correctly in that I can put this in the footer and get the sum of temperatures.

To work out the average, I put a field in the footer. In the "Data" tab I choose "Field or Formula" and enter [AccumulationLOWReport]/[RecordCounter] . When I run the report it returns 0.

I have tried all of the following, with the same result
' [AccumulationLOWReport]/[RecordCounter]'
' [AccumulationLOWReport]'/'[RecordCounter]'
= [AccumulationLOWReport]/[RecordCounter]

Can someone please tell me what I am doing wrong?

Hi :slight_smile:
Is it possible to see a lot more decimal places after the point? Like
0.000??
or do ' [AccumulationLOWReport]'*1000/'[Rec
ordCounter]'

Can you temporarily have the 2 fields reporting separately in the
header/footer to check that they are giving sensible results in there?
Regards from
Tom :slight_smile:

Hi Tom

I changed the display to 3 decimal places and it still comes out as 0.000

When I put the individual fields into the footer they report correctly, but trying to do operations with them seems to not work.

I have now tried every combination of quote marks including no quotes, and putting an = before the formula but it just returns 0 (or 0.000)

I've uploaded the database file to dropbox if anyone would like to look at it https://www.dropbox.com/s/w26g98jn58f74n0/Weather.tar.gz

Thanks

Keith

Hi Keith,

You'll hate this, but WJFFM.

I unzipped your upload, opened it (and amended the connection details),
edited the report, and saw the field you were referring to. In the "Data
Field" I saw the value was
"=[AccumulationLOWReport]/[RecordCounter]" (without the quotes, of
course). When I ran this, I got the zero as you reported, and as
expected. So I removed the "=" from the "Data Field", so that it now
shows "[AccumulationLOWReport]/[RecordCounter]" (without the quotes, of
course), selected another field (you seem to need to do this before
running the report so that it updates the field, otherwise it still
runs with the old formula), ran the report, and got an average of
16.655. Which is what you want, I think?

If this doesn't work for you, then I have no idea what is wrong.

I'm running LO 4.1.1.2 on Windows 7 64 bit.

Hope you figure it out.

Paul

Thanks Paul. It now WJFFM2 :slight_smile:

I'm wondering if there is something in the selecting another field first.

I was very careful to save before executing with each change, but I didn't select another field. So perhaps it was not really saving the changes although it appeared to be doing so.

Either that or you have some sort of ninja power that fixes things just by you being near them :slight_smile: My eldest son can go into a room and any misbehaving hardware instnatly fixed itself.

Keith

Hi Keith,

I think it's kind of like with database tables and data grids. If you
edit a field in the data grid, while you're still in the field you've
only changed the grid's cached copy of the data, once you exit the
field it updates the underlying table. I think the same sort of thing is
happening here. Maybe saving isn't enough, you have to actually set
focus to something else before it updates the actual formula.

Although I know what you mean about your son. I've been accused of that
sort of thing before. My mom will phone with a computer problem, only
to find that when she walks me through doing it, it now works :slight_smile:

Glad you got it sorted.

Paul