@Ajwou so first you will have to get all unique projects and then loop through those unique project list, inside the loop get unique department of each project and if length of list of unique department is 1, then project id has one department and if length of list of unique department is greater tan 1, then project id has more departments.
See below detailed steps:
1. Add Select action after the Get Items action, select value from dynamic content of Get Items in From parameter. Map Project ID with project ID column as shown below
2. Add Compose action and use following expression in compose action. This will give you list of unique project IDs.
union(body('Select'),body('Select'))
3. Now to loop through unique project ids, add apply to each action and use output of Compose action
4. Now under Apply to each action, add compose action and configure following expression
items('Apply_to_each_5')?['ProjectID']
5. Now add filter array action, in from parameter select value from dynamic contents of Get Items. in filter configure it as shown below, on right side of filter use output of compose action we added in step 4.
6. Now add Select action and in from parameter use output of filter array action from dynamic content. In map parameter configure as shown below, on right side of map parameter use item()?['Department'] expression
7. Add compose action with following expression
union(body('Select_2'),body('Select_2'))
8. Now add condition action to check length of unique department list of the project
length(outputs('Compose_9'))
In the yes branch of condition, then as per your logic go to list A, in no branch go to list B