Created a query with joins to different tables to get the right data.