# Using count in repeat groups

**URL:** <https://forum.dimagi.com/t/using-count-in-repeat-groups/3333>\
**Category:** Users\
**Created:** [March 10, 2017, 3:49pm UTC](https://forum.dimagi.com/t/using-count-in-repeat-groups/3333 "2017-03-10T15:49:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nicola\_Floyd](https://dimagi.b-cdn.net/letter_avatar_proxy/v4/letter/n/a88e4f/32.png) [@Nicola\_Floyd](https://forum.dimagi.com/u/Nicola_Floyd)\
**Post date:** [March 10, 2017, 3:49pm UTC](https://forum.dimagi.com/t/using-count-in-repeat-groups/3333/1 "2017-03-10T15:49:34Z")

</div>

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.
