'calculating TotalDomainCount in Azure Resource Graph

I have following line of code to calculating count of vms in our different domains but now I have issues to calculating total vm count so that I could later then calculate percentages.

Resources
| where type == 'microsoft.hybridcompute/machines'
| extend DOMAIN=tostring(properties.domainName)
| summarize count() by DOMAIN
**# this is the 'issue' line.** 
| extend TotalMachineCount = count_ 
| extend PerDomainMachineCount = count_

So TotalMachineCount should display count of all vms. PerDomainMachineCountt works fine.

And as i told above I would next calculating percentage with following line where I need total count

| extend Pct = 100 * bin(todouble(PerDomainMachineCount) / todouble(TotalMachineCount), 0.001)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source