sorry for asking maybe dumb questions

I have a datasource containing a list of users with office location and assigned license.
On the bottom of the page / end of list I'd like to count how many licenses are assigned to the corresponding office locations, i.e.
User A Location A License A
User B Location B License A
User C Location B License B
User D Location B License B
Totals:
License A: Location A 1
Location B 1
License B: Location B 2
Hope this is somewhat understandable and you guys can help me

Thanks!