I have a community site and users are uploading documents and participating in discussions. I want to generate a report using JS by users's department and I want to be able to Show the department name, count of all items from both the content types of Discusion lists (Discussion, message) and show the url of the items underneath the count of each.
I followed https://social.technet.microsoft.com/Forums/en-US/5cea71c9-c391-4000-9657-03f9852c1c61/how-to-run-a-report-by-users-department-in-a-site?forum=sharepointdevelopment and was able to get results but the department names are repeated in several groupings. It seems it is because of Discussion and Message content types.
Example:
Department X: (5)
Url 1
Url 2
Url 3
Url 4
Url 5
Department Y (2)
Url 1
Url 2
Department Z (10)