User/Group permissions

I am tasked with creating a non-onprem solution to handle our AD concerns. One issue that I am not seeing how Okta can handle (if it can handle?) is if I have a user that belongs to multiple agencies and the user can have different roles within those agencies. Please reference the attached screenshot for a visual.

I have been playing with Okta for a bit now and I just do not believe that Okta will solve this requirement of mine. Does anyone have a basic example of this working?

AAD%20Example