Using count in repeat groups

Hi, Im trying to use the count function in a repeat group to summarise how
many live births, still births etc a patient has had. The repeat group
works fine (driven from the no of pregnancies the patient has had). I
created a hidden value and put the following in the calculate box : count(
outcome_of_pregnancy [‘choice2’]) where outcome of the pregnancy is the
question asking what was the outcome and choice 2 is still birth. I got
this error message in the app preview. Can anyone explain where Ive gone
wrong? thanks very much, Nicola

Display Condition Error: Error in calculation for /data/no_of_stillbirths
XPath nodeset has more than one node
[/data/pregnancy_details[1]/result_of_pregnancy[1];/data/pregnancy_details[2]/result_of_pregnancy[1]];
cannot convert multiple nodes to a raw value. Refine path expression to
match only one node.