Change count in Custom Tab with table according to filtered data
I assume you used a tabset hook to adapt the tab on the contact page. That is where you can influence the count as you can see here:
  $tabs[] = [
    'id' =&gt; &quot;mediweattestbeheer&quot;,
    'url' =&gt; CRM_Utils_System::url(&quot;civicrm/mediweattestbeheer/page/mediweattest&quot;, &quot;reset=1&amp;mid=&quot; . $contactId, TRUE),
    'title' =&gt; &quot;Attesten&quot;,
    'weight' =&gt; 16,
    'count' =&gt; CRM_Mediweattestbeheer_BAO_MediweAttest::telAttestenMedewerker($contactId),
    'class' =&gt; &quot;livePage&quot;,
  ];

For the count parameter I have used a function that counts the number of records in the table for the specific contact.