This may help, however the query you shared doesnt look like the one in the Workbook error? Anyway taking the query provided, I use Materialize() to cache the data - so its only runs once rather than the 4 times with your let statements.
I only did a few basic tests, but it runs in roughly half the time, I'm not sure it will help, but worth a try against your data set.
let EndDate = startofmonth(now())-1s;
let StartDate = startofmonth(EndDate);
let cache_=
// build a cache of the data - query once, use many times if required
materialize
(
SecurityIncident
|where CreatedTime between(StartDate .. (EndDate))
// Gather only the necessary columns
|summarize arg_max(TimeGenerated, Severity, CreatedTime) by IncidentNumber
);
// Call the cache to get the Totals
cache_
| summarize count_ = count() by Severity="Total"
| as Total_
// Now union the results to get Total and the other Severities
| union cache_, Total_
// Remove Infomational
| where Severity !='Informational'
| summarize Count=count() by Type=Severity, count_
// Tidy up the count columns
| extend Count = iif(isempty(count_), Count, count_)
| project-away count_
// Perform a sort by numbered row
| extend Row = case (
Type=='Total',1,
Type=='High',2,
Type=='Medium',3,
Type=='Low',4,
// else
0
)
|project-reorder Row, Type
|order by Row asc