To get the number of rows you need to get the count of the repeater instead of the count of a sub field of that repeater. You need to get the count in the parent before your call have_rows
for the parent. The reason for this is that ‘child_repeater’ is not a sub field of child_repeater
while( have_rows('parent_repeater') ) : the_row();
// ...
$count = count(get_sub_field('child_repeater'));
if( have_rows('child_repeater') ):