XLOOKUP

XLOOKUP(value, lookup list, result list, [if not found])

Looks a value up in one list and gives back the value beside it in another, as Excel's XLOOKUP does with an exact match. Its use in Owl is reading a value you worked out for every task in a LET, such as each task's floor taken out of its name, for this row and for the rows a relation reaches: you write the floor once, over All, and look it up for [Task], for Predecessors[Task] or for a relationship's [Successor]. The lists are the same for every row, so they are read once into a table of keys; each lookup is then immediate, however large the schedule.

Arguments

ArgumentWhat to give it
valueWhat to look for: one value, like [Task] or [Task code], or a list of them, like Predecessors[Task]. A list gives back a list, one result for each. Blank gives blank.
lookup listWhere to look: a column that is the same for every row, like All[Task], All[Task code] or Relationships[Successor], or a value worked out from one in a LET. Text is matched ignoring case, a date by its day, as = matches them.
result listWhat to give back: a column of the same set as the lookup list, so the two line up, like All[Name] beside All[Task code].
if not foundOptional. What to give back where the value isn't in the lookup list. Leave it out and the result is blank.

Where the lookup list holds the value more than once, the first in schedule order wins.

Examples

Formula
=XLOOKUP("BDC_001", All[Task code], All[Duration])

The duration of BDC_001, on every row: 3 days.

Formula
=LET(t, All, phase, UPPER(t[Phase]), TEXTJOIN(", ", XLOOKUP(Predecessors[Task], t[Task], phase)))

Each predecessor's phase, in capitals, worked out once for every task and read for this row's predecessors: "CIVIL" for BDC_001.

Formula
=LET(t, All, top, TEXTBEFORE(t[WBS], " / "), COUNT(FILTER(Predecessors, XLOOKUP(Predecessors[Task], t[Task], top) = XLOOKUP([Task], t[Task], top))))

How many predecessors sit under the same top WBS level as this task. top is written once; the two lookups read it for the predecessors and for this task.

Formula on relationships
=LET(t, AllTasks, phase, t[Phase], XLOOKUP([Predecessor], t[Task], phase) = XLOOKUP([Successor], t[Task], phase))

On the relationships table: TRUE where both ends of the link are in the same phase.

Formula
=XLOOKUP([Phase], All[Discipline], All[Task code], "none")

The first task whose discipline is this task's phase, or "none".

Reach for something else when

You wantUse
A stored field of a related taskThe relation itself: Predecessors[Finish date], WBSNode[Name]
One task by its codeTASK: Task("A1000")[Finish date]
Every match, not the firstFILTER, then an aggregate: SUM(FILTER(All, All[Phase] = [Phase])[Duration])
The row with the least or greatest valueARGMIN, ARGMAX

Common questions

Why does the editor say the lists must be “the same for every row”?

XLOOKUP reads its lists once, before any row, so they can't depend on the row: Predecessors[Task code] is a different list on each task. To look in a row's own set, filter it:

The editor refuses this
=XLOOKUP("A1000", Predecessors[Task code], Predecessors[Name])

Write FIRST(FILTER(Predecessors, Predecessors[Task code] = "A1000"))[Name].

Why not just repeat the expression for the predecessors?

You can: TEXTBEFORE(Predecessors[WBS], " / ") works. But a definition used for this row, for its predecessors and for a relationship's two ends would be written out three or four times, and kept in step by hand. Written once over All and looked up, it is one definition, worked out once for the whole schedule.

Is it slow on a large schedule?

No. The lookup list is read once into a table of keys, and each value is found in it directly, not by searching the list, so 20,000 lookups into 20,000 tasks take a few milliseconds.