Hi,
Try with the query below. Set aggregation granularity to 12 hours. For Measure choose HeartBeatMissing and for aggregation type Average. Add Computer and _ResourceId as dimensions. Operator is greater than 0.
Heartbeat
| summarize LastCall = max(TimeGenerated) by Computer, _ResourceId
| extend HeartBeatMissing = iff(LastCall < ago(2h), 1, 0)
If you want to use the automitigate feature you will have to generate results and if alert is generated or not will depend on the threshold. If the threshold is no longer met but the _ResourceId is still in the results of the query automitigate will know to resolve the alert. Also if you want to have this by Computer and _ResourceId those columns needs to be in dimensions.
Please "Accept the answer" if the information helped you. This will help us and others in the community as well.