Assuming you are using LabVIEW, you just keep the count and the current state of the digital input in shift registers. When you detect the change, increment the count.
Another alternative is to use a counter. Read the count every so often. I don't remember if DAQmx resets the count on a read. If it does, just add to the count that is stored in a shift register.
What equipment are you using? What language?
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5