What did you use for post ID, also, this should go before your loop.
$post->ID
$flex_field_array = get_post_meta($post->ID, 'flexible_field', true);
$count = 0;
if (is_array($flex_field_array)) {
$count = count($flex_field_array);
}
echo $count;
if( have_rows('flexible_field') ):