AnsweredAssumed Answered

calculation on different rows in same column

Question asked by StephenFrost on Jan 21, 2009
Latest reply on Jan 26, 2009 by comment_1

Title

calculation on different rows in same column

Post

can anbody tell me how to make a calculation (a simple subtraction) between different rows in the same column. we have a database with patient IDs in one column, scores on tests in other columns, and visit numbers in another column. basically, i want to calculate the difference between scores on the tests between each visit for each patient (e.g., patient1, test1, visit 2 score - visit 1 score, etc., etc.). just to be clear - all the scores for a given test are in a single column but different rows correspond to scores on a given visit.

 

patient    testAscore visit#

 0001      75              1

 0002      82              1

 0001      88              2

 0003      90              1

 0004      67              1

 0002      88              2

....etc., etc.

 

and i want to calculate 0001 88-75; 0002  88-82 , etc., etc.

Outcomes