is there a way to make it work when it uses the value from another query?
IMO, only via subquery (where [Max of time] value is retrieved) OR include the query in the design grid and add that field from that query. Your issue is that the query has no idea where to get the value from - it cannot do some sort of lookup just because you designed it without including the query as one of the table sources.
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.