Hello,
Generally speaking, you would need to use two counters for this task configured for alternate edges and sum them together. But the method varies depending on the hardware you are using.
Could you provide some further information on the hardware you are using and the application itself? Are you using a quadrature encoder of some sort?
Kind Regards,