Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Posted: 26 Dec 2014 at 5:55am
it appears that this is a multiple row calculation so what you are trying to do is calculate the difference between a min and max value or only on specific dates?
if specifc date then create a formual field to do it for you
if date= firstdate then value else
if date =secondate then value *(-1)
else 0
sum this (likely at a group level to get your value for that group.
You would really need to explain your entire data set more to get more help though.
Joined: 30 Oct 2012
Online Status: Offline
Posts: 104
Posted: 29 Dec 2014 at 5:54am
Yes it is a multiple row calculation.
The dates are not specific, rather I need to calculate the difference between the most recent reading and the reading before it. The date is grouped by reading device
Joined: 30 Oct 2012
Online Status: Offline
Posts: 104
Posted: 29 Dec 2014 at 8:59am
I am almost at a solution, but can't quite get it to work right.
I created a formula field titled DIFF as the following:
if {table.meter_id}= Previous({table.meter_id}) then
({table.reading}) - previous({table.reading}) else
0
When I place this field in the detail section of the report, I get the difference between two fields, but the calculation is returning the difference in the previous row instead of the most recent row.
Joined: 30 Oct 2012
Online Status: Offline
Posts: 104
Posted: 29 Dec 2014 at 9:35am
I figured it out. I replaced "previous" with "next". I didn't realize "next" was a keyword and to me it seemed like previous would have made the most sense since I was subtracting a value from an earlier date.
I don't exactly understand why the solution I came up with works, but it works, so I'm happy enough.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum