Which guide are you following? For the rule that you are using, you would filter by capabilityStatus
(user.assignedPlans -all (assignedPlan.capabilityStatus -eq "Enabled")) -and (user.userType -eq "Member")
or, for a specific plan you could do:
(user.assignedPlans -any (assignedPlan.servicePlanId -eq "<servicePlanId>" -and assignedPlan.capabilityStatus -eq "Enabled"))
There is a discussion here around different methods of accomplishing this.
You can also follow the instructions in View licensed and unlicensed Microsoft 365 users with PowerShell to display only the licensed users:
Get-MsolUser -All | where {$_.isLicensed -eq $true}
There are multiple ways to do this though, and several are also covered in this thread.
Let me know if any of these work for you. I'm happy to troubleshoot if you run into any issues.