It can be done using the reporting functions. This would be via Tidal Intelligent Reporting in v5 or through the JAWS framework in V6. We've also done our own thing by tying the TIR database into our corporate reporting tools so we can create custom reports along the lines you are talking about.
In theory you could also do this directly from the main database but for performance reasons you might not want to go down this route.
Cheers