I am working with an extract from our contracts database and a list of supplier expenditure. From the list of supplier spend, i have identified our Top100 suppliers. I now need to identify to which Category each supplier belongs. if the contracts data consisted of a single entry per supplier, this would not be difficult. However, with contracts, each supplier may have multiple contracts in their own right or they may be one of several parties to a contract. The contracts data can also contain expired contracts.
mockup data below
Basic spend data
Mock up Contract data
so, the result i am after is a lookup that returns the category specified in the contracts data so long as the end date has not already passed. Take Glub Pty Ltd as an example. The first three contracts involving Glub have expired so I don't want the Category associated with these. The 4th time it is listed in the contract data (K9087), the expiry date is in the future so i want that Category (Chemicals). Another example would be Bondi P/L. Contract K6022 has expired, but the next one K8008 has not.
mockup data below
Basic spend data
Company Name | Expenditure | Category |
Apples | 1000 | |
Bondi P/L | 900 | Construction |
**** a doodle doo | 750 | |
Dingo Dog Ltd | 725 | |
Echo echo | 690 | Sonar |
Frogs Red.yum yum | 574.5 | |
Glub Pty Ltd | 495 | Chemicals |
Hod P/L | 415.5 | |
I-Wash | 336 | |
J-Lo Inc | 256.5 | |
Mock up Contract data
Party | Contract Number | Contract Description | Start Date | End Date | Category |
Bondi P/L | K3456 | Good Stuff | 29/10/2020 | 28/04/2021 | Support Services |
Glub Pty Ltd | K9876 | Bad Stuff | 7/09/2020 | 6/09/2021 | Software & Licences |
Hod P/L, J-Lo Inc, Brother B, Glub Pty Ltd | K5264 | Stuff you | 24/11/2020 | 23/11/2021 | Software & Licences |
Dingo Dog Ltd, Glub Pty Ltd,E | K8356 | Your Stuff | 2/10/2020 | 1/12/2021 | ICT Services |
Frogs Red.yum yum | K2739 | My Stuff | 23/05/2023 | 31/07/2023 | Fleet & Fuel |
Frogs Red.yum yum | K6100 | Not My Stuff | 1/09/2018 | 31/08/2023 | Construction |
Bondi P/L | K6022 | Who's Stuff is this | 7/10/2021 | 6/10/2024 | Construction |
Bondi P/L | K8008 | Stuff it | 1/08/2022 | 1/12/2024 | Construction |
Bondi P/L | K7355 | OK Stuff | 1/04/2024 | 20/12/2024 | Construction |
Glub Pty Ltd | K9087 | Holiday stuffing | 21/05/2024 | 20/05/2025 | Chemicals |
Frogs Red.yum yum, Dingo Dog Ltd | K4069 | Get Stuffed | 1/07/2017 | 30/06/2025 | |
Glub Pty Ltd | 14/06/2022 | 14/07/2025 | |||
Echo echo | 1/02/2024 | 31/01/2027 | Sonar | ||
7/05/2024 | 6/05/2027 | ||||
so, the result i am after is a lookup that returns the category specified in the contracts data so long as the end date has not already passed. Take Glub Pty Ltd as an example. The first three contracts involving Glub have expired so I don't want the Category associated with these. The 4th time it is listed in the contract data (K9087), the expiry date is in the future so i want that Category (Chemicals). Another example would be Bondi P/L. Contract K6022 has expired, but the next one K8008 has not.