Filter sales person in sales invoice bases on item group

I have added multiple item groups to sales person
Also have added custom field branch and Item Group to sales invoice
How to filter sales person in sales invoice based on branch and item group(in sales invoice) ?

Please refer to the following guide :

https://erpnext.org/docs/user/manual/en/selling/setup/sales-person-target-allocation

Thanks for reply
But i want is a way to write custom script to get filtered list in sales person bases on assigned item groups .