बेशक यह संभव है। हालांकि आपने अपना कोड नहीं दिया था इसलिए मैं आपको स्यूडोकोड दूंगा।
writeheader();
$team = $data[0]['team'];
$count = 0;
foreach($data as $row){
$count += 1;
//if the current row's team is different than previous than add seperator
if($row['team'] != $team){
$team = $row['team'];
writeseperator();
writetotal($count);
$count = 0;
}
writerow();
}