Count number of sprints an issue was not completed in

Hi,

we would like to count the number of sprints an issue was not completed in. What might be the best way to solve this requirement?

Best regards, Lisa