I have come across some PowerShell commands that allow me to fetch data for these categories, but they seem to provide only the latest data (last 10 days). Is there a way to fetch older data, such as the data from the past 6 months? I would like to have a historical perspective in my chart.
Do you mean Get-Messagetrace?
Exchange Online can provide message trace result up to the last 90 days if you use the Start-HistoricalSearch cmdlet.
Once the search is finished, you can download the report in Exchange Admin Center.
For more detailed information this link may be helpful: Running Exchange Online Historical Message Traces
(Please Note: Since the web site is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.)
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.