Show all used units/terrain listed in a window

Hello guys, i want to add a window, which shows all used units/terrain of a scenario similar pic above.
But is it possible, that the list shows each kind of unit/terrain picture once with the number of used units/terraintiles,
instead listing all single unit/terrain paritcular?