Good day, salloumrola.
Yes, QuickBooks Online can run report by departments.
To do this, you need to turn on the track location setting first.
Once done, you can pull up the department reports by following these steps:
Here's an article for more details on How to Set up and Use Class and Department (Location) Tracking.
Feel free to post again in the QuickBooks Community space if you have any other concerns. Have a wonderful day!