Because you call the count method this will return just one value and int precisely which is the number of element that correspond to your MacMarcacao::select(['data', 'agenda_id'])->groupBy('data', 'agenda_id') you will not get all other fields because the count method return a value not a Collection like you are expecting.
You must firstly retrieve your record and after that you can count the method cound
$agendas = MacMarcacao::select(['data', 'agenda_id'])->groupBy('data', 'agenda_id')->get()
After that you can count number of records in your $agendas which is a an object of type Illuminate\Support\Collection
$numberOfAgendas = $agendas->count();