WhatCount and WhoCount fields will be available in Task and Event Object when Salesforce Shared Activities feature is enabled.
Salesforce Shared Activities is enabled when the “Allow Users to Relate Multiple Contacts to Tasks and Events” is enabled in Activity Settings.
SOQL on Task:
SELECT WhatCount, WhoCount
FROM Task
SOQL on Event:
SELECT WhatCount, WhoCount
FROM Event