Forum Discussion
Lookup values across two tables
- 5 years ago
I've solved my own problem. Cool! Here are the tables with the solution added. The key was to bring over a column from the lookup table so I could do calculations on it in this table. So, in InstructorQualfications, I added Units from the QualsFromUnits table. In TrainingProgress, I added Qualification from the QualsFromUnits table.
There might have been a more efficient way to do this, but this was what I found worked.
Suggestions, comments, feedback are welcome in an effort to teach me more stuff!
Table name: InstructorQualifications
Calculated columns:
Unit =
LOOKUPVALUE (
QualsFromUnits[Unit],
QualsFromUnits[Qualification], InstructorQualifications[Qualification]
)Unit Passed =
CALCULATE (
MAX ( TrainingProgress[Grade] ),
FILTER (
TrainingProgress,
TrainingProgress[Grade] = "S"
&& InstructorQualifications[Name] = TrainingProgress[Name]
&& InstructorQualifications[Unit] = InstructorQualifications[Unit]
)
)Table name: TrainingProgress
Calculated columns:
Qualification =
LOOKUPVALUE (
QualsFromUnits[Qualification],
QualsFromUnits[Unit], TrainingProgress[Unit]
)HasQualification =
CALCULATE (
MAX ( InstructorQualifications[Qualification] ),
FILTER (
InstructorQualifications,
TrainingProgress[Grade] = "S"
&& TrainingProgress[Name] = InstructorQualifications[Name]
&& TrainingProgress[Qualification] = InstructorQualifications[Qualification]
)
)
Unfortunately, my solution didn't work in my real data. It appears I'm not understanding filters and row context well enough. Out of thousands of what should be "S" results for Unit Passed, I got only one. I think it's picking just one person and one unit to find an "S" and is ignoring all other people and units.
My original solution did work. It turned out I had an overabundance of relationships that were confusing the formula.
Too many people-identifiers were going directly from table to table and to the person lookup table. I made them all go only to the person lookup table and the formula's results cleaned right up.