This reduced query will do the same thing (the Pie chart render adds the % calculation anyway, so you dont need to do that)
SecurityEvent
| where TimeGenerated > ago(31d)
| summarize Count = count() by EventID, Activity
| sort by Count desc
| top 5 by Count
| project Activity, Count
| render piechart
If you have a few Workspaces, then you could do a simple cross workspace query https://learn.microsoft.com/en-us/azure/azure-monitor/logs/cross-workspace-query
e.g. Just add more workspaces to row 1 (or see the docs above to create a function to do this especially if you have a lot)
union SecurityEvent, workspace("workspace 1"). SecurityEvent
| where TimeGenerated > ago(31d)
| summarize Count = count() by EventID, Activity
| sort by Count desc
| top 5 by Count
| project Activity, Count
| render piechart
If this helps please accept the answer?