I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to "Accept " the answer.
Issue:
I have been attempting to identify VM Backups that have been orphaned by the deletion of their VM they are backing up and am putting together a workbook to track these resources. I have been working on a query to pull them but so far can not get it to properly filter out the backups that have no associated VM by name.
Solution (provided by @Liam Hosfeld )
RecoveryServicesResources | where type in~ ('Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers/protectedItems')|extend policy = properties.policyInfo.policyId| extend vaultName = case(type in~ ('microsoft.dataprotection/backupVaults/backupInstances', 'microsoft.dataprotection/backupVaults/deletedBackupInstances'),split(split(id, '/Microsoft.DataProtection/backupVaults/')[1],'/')[0],type =~ 'Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers/protectedItems',split(split(id, '/Microsoft.RecoveryServices/vaults/')[1],'/')[0],'--')| extend vaultId = case(type in~ ('microsoft.dataprotection/backupVaults/backupInstances', 'microsoft.dataprotection/backupVaults/deletedBackupInstances'),tolower(split(id, '/backupInstances/')[0]),type =~ 'Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers/protectedItems',tolower(split(id, '/backupFabrics/')[0]),'--')| extend dataSourceType = case(type =~ 'Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers/protectedItems',strcat(properties.backupManagementType,'/',properties.workloadType),type in~ ('microsoft.dataprotection/backupVaults/backupInstances', 'microsoft.dataprotection/backupVaults/deletedBackupInstances'),properties.dataSourceInfo.datasourceType,'--')| extend friendlyName = properties.friendlyName| extend dsResourceGroup = split(split(properties.dataSourceInfo.resourceID, '/resourceGroups/')[1],'/')[0]| extend dsSubscription = split(split(properties.dataSourceInfo.resourceID, '/subscriptions/')[1],'/')[0]| extend lastRestorePoint = case(isnull(properties.lastRecoveryPoint), properties.lastBackupTime, properties.lastRecoveryPoint)| extend primaryLocation = properties.dataSourceInfo.resourceLocation| extend parentType = properties.parentType| extend instanceName = case(isnotnull(properties.serverName),strcat(properties.serverName,'/', properties.parentName), 'NA')| extend policyName = case(type in~ ('microsoft.dataprotection/backupVaults/backupInstances', 'microsoft.dataprotection/backupVaults/deletedBackupInstances'), extract(@'([^/]*)/backupPolicies/([^/]*)', 2, tostring(policy)),type =~ 'Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers/protectedItems', properties.policyInfo.name,'--')| extend protectionState = properties.currentProtectionState| extend managedIdentity = case((properties.identityDetails.useSystemAssignedIdentity == false), 'userassigned', 'systemassigned')| project id, name,type, resourceGroup, vaultName, friendlyName, instanceName, subscriptionId, dataSourceType, protectionState, policyName, primaryLocation, lastRestorePoint, properties, dsResourceGroup, dsSubscription, location, parentType, managedIdentity, resourceId =
case(
type in~ ('microsoft.dataprotection/backupVaults/backupInstances', 'microsoft.dataprotection/backupVaults/deletedBackupInstances'),
tolower(tostring(properties.dataSourceInfo.resourceID)),
type =~ 'Microsoft.RecoveryServices/vaults/backupFabrics/protectionContainers/protectedItems',
tolower(tostring(properties.sourceResourceId)),
'--')
| where isnotnull(resourceId) and isnotempty(resourceId)
| join kind = leftouter (Resources | where type in~ ('microsoft.compute/virtualmachines','microsoft.classiccompute/virtualmachines')
| extend resourceId = tolower(id), backupItemId = id) on resourceId
| extend Resource_Exists = isnotempty(backupItemId)
| extend extendedLocationId=tolower(extendedLocation.name)
| extend extendedLocationName=split(extendedLocationId, "/customlocations/", 1)[0]
| where (Resource_Exists == (0))| where (protectionState in~ ('ConfiguringProtection','ProtectionConfigured','ConfiguringProtectionFailed','ProtectionStopped','BackupsSuspended','SoftDeleted','ProtectionError')) and (dataSourceType in~ ('AzureIaasVM/VM'))