Simple midi note counter (per bar)

Peta Dore's icon

Hi,
I'm a bit stuck with how to create a simple counter to count how many MIDI notes have been triggered in the last bar. E.g. I have another device (M4L Grids) in the chain, and I would like to see how many individual midi notes have been triggered in the last bar. I can of course record a bar of MIDI and count the notes, but it would be great to have a counter that does it for me.
If I change the pattern on Grids and there is a different count of notes in the bar, the counter would update itself. So presumably it would keep counting each last bar, and update the count if it's different.
Thank you in advance for your help!

stoersignal's icon

observe the clip, dismiss the notevalues and count only velocities above 0.

or do i understand something wrong?