Page 1 of 1
Finding difference b/w values stored in same database field
Posted: Fri Jul 06, 2012 9:54 am
by JB429
I need to create an expression to find the difference between two time values which are stored in the same field in a database table but different record lines. There are two records which represent the same transaction at two different points in time, and I need to know how long it took to get from point A to B.____Can someone help? Thanks!
=> RE: Finding difference b/w values stored in same database field
Posted: Thu Jul 19, 2012 4:36 pm
by cstrasser
If you can sort the transactions so that they are in order and stacked sequentially, you can make use of the PREVIOUS() function in R&R.____For instance, say there are three records for a given customer in a table and there is a calculated field called PrevTranDt defined as PREVIOUS(TRANSDATE). You^d see:____COMPANY TRANSDATE TRANSAMT TRANSCT PrevTranDt__HEWPAK 01/18/2012 50.00 CHG *****__HEWPAK 02/21/2012 50.00 PMT 01/18/2012__MICSOF 03/15/2012 100.00 CHG 02/21/2012____You^d be able to use PrevTranDt and TRANSDATE together in a calculation to find that there were 34 days between the transactions. You^d have to handle the situations where the first record is undefined (i.e. the asterisks) as well as when the customer changes in this case and not compute the difference between unlike entries.__