Hi Team,
I have one requirement in Qlik, I have one table with few associated records for every product id.
I needs to fetch one record/Sales person to contact for one group based on product id and below logic.

I needs to find out only one record top hierarchy if manager available in Role I needs to fetch manager record if manager is not available for that product id i need to fetch next hierarchy Sales lead if there any duplicate role we needs to fetch any one of them.
Expected Output:

Can anyone help in this scenario.
Data to copy:
Product ID |
Product |
Status |
Sales Person |
Role |
XAM85201 |
Food |
Warehouse1 |
John |
Sales Person |
XAM85201 |
Baverages |
Warehouse2 |
Mark |
Sales Lead |
XAM85201 |
Cookies |
Warehouse3 |
David |
Sales manager |
TDOX5684 |
Food |
Warehouse2 |
Josep |
Sales Lead |
TDOX5684 |
Food |
Warehouse3 |
Victor |
Sales Lead |
Best Regards,