I think the best option would be to use a linking table.
In the linking table concatenate all distinct function and location combinations from each of the tables. Use a combination of the function and location as a key to connect to the other tables. You should then be able to use the function field in this table to filter the other 2 tables.
How are you linking those tables? compound key?
Agree with rachel.delany the best approach to use link table. (As soon as data sets are completely different)
Create a compound key Autogenerate(function&location) as Key in both tables, then
LOAD DISTINCT Key, function, location Resident table1;
LOAD DISTINCT Key, function, location Resident table2;
Don't forget to remove original fields from table1 and table2.
DROP FIELDS function, location FROM table1, table2;
And then use function and location field from your [Link Table] as a dimension - which will cover both data sets.
Hope this helps.