A bit late maybe, but it might help someone: you can simply group by the sort field, so when that sort field is repeated, it will sort and group at the same time.
<p-table [value]="data" groupRowsBy="index" rowGroupMode="rowspan" >