Hi BiloJon,
You can use the Selectable objects constraints option which is available in the Reference selector widgets to filter the departments based on the location selection as jop ter Horst said.
For your reference, I m sharing the Mendix documentation with a detailed explanation of the Selectable Objects constraint. I hope, it will help you.
https://docs.mendix.com/refguide/reference-selector#:~:text=1%20Select%20Using&text=The%20reference%20selector%20allows%20the,page%20selection%20pop%2Dup%20window.
Thanks and regards,
Vijayabharathi V
You should add some constraint to the selectable objects in the Departments dropdown. So you only see departments of the selected legal entity.