Skip to main content
Announcements
Customer Spotlight: Discover what’s possible with embedded analytics Oct. 16 at 10:00 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
agsearle
Creator
Creator

Difference in fields

I have a QVD with meter readings data in it. This is made up of one row for each reading, therefore each customer will have numerous rows of readings.

This data will have:

Customer Number - Reading Date - Meter Reading

1234                      01/09/2010       100

1234                      01/12/2010       110

1234                      01/02/2011       135

I need to work out the difference between the last reading and the reading before, for each customer. So for the example above the difference would be 25. I can identify the latest reading by MAX(Meter Reading), but can't think how to subtract the second highest reading?

Can this be done in either the script or via an expression in a chart table?

1 Solution

Accepted Solutions
richnorris
Creator II
Creator II

Pretty sure you can actually just subtract max(Meter reading, 2), max takes a parameter for the rank as well as for the data field.

View solution in original post

4 Replies
Not applicable

Hi,

You can do this using Peek() function in script. Peek function will not work in Charts.

- Sridhar

rahulgupta
Partner - Creator III
Partner - Creator III

Hey Hi,

Kindly Find the attached file for your solution.

Regards

richnorris
Creator II
Creator II

Pretty sure you can actually just subtract max(Meter reading, 2), max takes a parameter for the rank as well as for the data field.

agsearle
Creator
Creator
Author

Of course. Didn't even think of that, works fine, thanks!