Token for Total Flag Count
You try code:

/**
 * Implements hook_tokens().
 */
function mymodule_tokens($type, $tokens, array $data, array $options, \Drupal\Core\Render\BubbleableMetadata $bubbleable_metadata) {
  $replacements = array();
  if($type == 'comment' &amp;&amp; !empty($data['comment'])) {

    foreach($tokens as $name =&gt; $original) {
      switch($name) {
        case 'flag-helpful-count':
          //$comment = \Drupal\comment\Entity\Comment::load($data['comment']-&gt;get('cid')-&gt;value);
          //$count_flag = \Drupal::service('flag.count')-&gt;getEntityFlagCounts($comment);
          $replacements[$original] = 10;
          break;
      }
    }
  }
  return $replacements;
}

function mymodule_preprocess_comment(&amp;$variables) {
  $token_service = \Drupal::token();
  $token_count_flag = $token_service-&gt;replace('[comment:flag-helpful-count]', array('comment' =&gt;
    $variables['elements']['#entity']));

}