In QuickBooks Online, the ability to add a cost centre is currently unavailable. However, the system has a feature called Project, which you can use to track or quickly calculate your cost. This also includes income and profitability. If you want to know more about this feature, I highly suggest checking out this article: Track income, costs, and profitability by project.
On the other hand, you can also use Class tracking and run Profit and Loss by Class report. Here's how to enable class tracking:
Go to Gear icon ⚙ and select Account and Settings.
Select Advanced, then select the Categories section to edit.
Check Track classes.
Check Warn me when a transaction isn't assigned a class. This is optional, but it's good to turn on, so when you look at reports, you know everything got classified.
Under Assign classes, select One to entire transaction or One to each row in transaction.