Hello,
I have an Access database which stores data pulled in by another program from several machines in several locations. The data contains a date of the data reading at random intervals (random, because occasionally the connection fails due to machine being offline), the ID of the machine, the ID of the reading event and a numeric value. So, something like this:
Date MachineID ReadingID Data
2016-11-20 Machine123 998877 142
2016-11-21 Machine123 887766 152
2016-11-25 Machine123 665544 167
2016-11-20 Machine456 998878 168549
2016-11-22 Machine456 776655 168551
2016-11-25 Machine789 665545 35841
2016-11-20 Machine789 998879 37521
etc.
The ReadingID is always different, so each is a unique value. However, they are not in any sequence due to the way the data is being pulled.
What I would like Access to do is calculate the difference between the data pulls for each machine, ie. how much the numbers have grown since last pull. So the results would be like this:
Date MachineID ReadingID SinceLastData
2016-11-20 Machine123 998877 0
2016-11-21 Machine123 887766 10
2016-11-25 Machine123 665544 15
2016-11-20 Machine456 998878 0
2016-11-22 Machine456 776655 2
2016-11-25 Machine789 665545 0
2016-11-20 Machine789 998879 1680
Any ideas how to accomplish this? I can't get my head around telling Access what is the previous value or how to obtain it from the records for each row.
Cheers!
Best regards,
YariLei
I have an Access database which stores data pulled in by another program from several machines in several locations. The data contains a date of the data reading at random intervals (random, because occasionally the connection fails due to machine being offline), the ID of the machine, the ID of the reading event and a numeric value. So, something like this:
Date MachineID ReadingID Data
2016-11-20 Machine123 998877 142
2016-11-21 Machine123 887766 152
2016-11-25 Machine123 665544 167
2016-11-20 Machine456 998878 168549
2016-11-22 Machine456 776655 168551
2016-11-25 Machine789 665545 35841
2016-11-20 Machine789 998879 37521
etc.
The ReadingID is always different, so each is a unique value. However, they are not in any sequence due to the way the data is being pulled.
What I would like Access to do is calculate the difference between the data pulls for each machine, ie. how much the numbers have grown since last pull. So the results would be like this:
Date MachineID ReadingID SinceLastData
2016-11-20 Machine123 998877 0
2016-11-21 Machine123 887766 10
2016-11-25 Machine123 665544 15
2016-11-20 Machine456 998878 0
2016-11-22 Machine456 776655 2
2016-11-25 Machine789 665545 0
2016-11-20 Machine789 998879 1680
Any ideas how to accomplish this? I can't get my head around telling Access what is the previous value or how to obtain it from the records for each row.
Cheers!
Best regards,
YariLei