Thank you for your question.
In case the flat form is used, the data can not be grouped as shown in the image.
Our recommendation is to pay attention to the pivot form (classic/compact) of the table.
Please see an example we have prepared. It demonstrates an approach allowing to configure the similar structure.
We hope it works for your case.
You are welcome to contact us in case any additional questions occur.