Last value Multiple Criteria

Hi,

I’m trying to find the last value which is a price in another table, but only if that value is equal to the ingredient I’m looking for. The formula is as follows:

MAXROW(“DETALLE CASHFLOW”, “MARCA TEMPORAL”, ([_THISROW].[INGREDIENTE] = [PRODUCTO EQUIVALENTE]))

The problem is that Appsheet says the following: The expression is valid but its result type ‘Ref’ is not one of the expected types: Price.

What can I do?

Thanks!

You’ll need to use the MAXROW() result with the LOOKUP() function to get the desired column value:

LOOKUP(
  MAXROW(“DETALLE CASHFLOW”, “MARCA TEMPORAL”, ([_THISROW].[INGREDIENTE] = [PRODUCTO EQUIVALENTE])),
  "DETALLE CASHFLOW",
  "row-key",
  "wanted-column"
)

replacing row-key with the name of the key column of the DETALLE CASHFLOW table, and wanted-column with the name of the column from that same table from which you want the value.

Thanks Steve! The only issue now is that the app crashes with this formula. When I try to open the form, the app freezes. The formula is in a virtual column, don’t know if it has to do anything with the problem.

Nop… It still crashes even though the formula is now in a real column. What to do? Thanks.

Crashes?! Yikes! For that, you’re better off engaging support@appsheet.com directly.

Hi Steve,

Support was very kind, but was not able to give a solution. Your formula is right and it is the best formula for this purpose. Still, with a database of only 1.250 rows, the app crashes. The solution they gave me was to slice the base.

Thanks for your help, just wanted to let you know what support told me.

1 Like