Find latest row that matches these criteria

Hi,

I am trying to create an expression that I can use in a columns initial value.
I want it to return the latest row that matches column Equipment.
I have this:

ANY(
SELECT(Pre Start[Equipment],
([_ROWNUMBER] = MAX(SELECT(Pre Start[_ROWNUMBER],
([_THISROW].[Equipment] = [Equipment]))))))

Which is interpreted by appsheet as:

One randomly chosen value from this list (
โ€ฆThe list of values of column โ€˜Equipmentโ€™
โ€ฆfrom rows of table โ€˜PRE STARTโ€™
โ€ฆwhere this condition is true: ((The value of column โ€˜_RowNumberโ€™) is equal to (MAX(
โ€ฆThe list of values of column โ€˜_RowNumberโ€™
โ€ฆfrom rows of table โ€˜PRE STARTโ€™
โ€ฆwhere this condition is true: ((The value of โ€˜Equipmentโ€™ from the row referenced by โ€˜Timestampโ€™) is equal to (The value of column โ€˜Equipmentโ€™))))))

I tried to do this:
ANY(
SELECT(Pre Start[Equipment],
AND(([_ROWNUMBER] = MAX(SELECT(Pre Start[_ROWNUMBER]))),
([_THISROW].[Equipment] = [Equipment]))))

But the select function becomes invalid

Any ideas on how I could select the latest row where equipment matches equipment?

Solved Solved
0 12 5,087
1 ACCEPTED SOLUTION

I think you want this:

View solution in original post

12 REPLIES 12
Top Labels in this Space