Try implementing the below solution :
- Have an external for each activity with iterations equivalent to distinct ex_priority values and make it sequential
- within the foreach, have a lookup activity to get the number of rows for that ex_priority value
- Pass that output to an execute pipeline activity and that execute pipeline activity would contain another for each activity with settings kept parallel and the iterations equivalent to the lookup output.