MAXROW plus _RowNumber Expression help


I am trying to create an expression that will create the initial value of a form field with the last value used on the last form’s entry. Reading through other questions and docs I think the MAXROW with _ROWNUMBER expression would work but I can’t seem to get the syntax correct.

MAXROW("MyTable", "_RowNumber") Works but the list of values comes from the first column in the table, which is the key column, which is not the column I want.

MAXROW("MyTable", "MyColumn", "_RowNumber") gives me this error:

Column Name ‘MyColumn’ in Schema ‘MyTable_Schema’ of Column Type ‘Text’ has an invalid Initial Value of ‘=MAXROW(“MyTable”, “MyColumn”, “_RowNumber”)’. SELECT has invalid inputs

Basically “MyColumn” is a list of products. On the form it is set as a dropdown selection. For the forms purpose Product A will be used for the first ten entries and Product B for the next ten, etc. I want to avoid the user having to select Product A from the dropdown every time and have it’s initial value as Product A until Product B is selected in which case the new initial value would be Product B until Product C is selected, and so on. Can someone put me on the right track here?

1 Like

Thanks for the reply. Unfortunately this doesn’t seem to be working. I do not get any errors but the formula doesn’t have any effect on the app. I tried changing [_THISROW] to [_THISROW-1] as I read that was a solution for a similar problem and that does give my form field an initial value, however it seems to be somewhat random, not the last product selected as needed. Here is the exact formula I am using with actual table names if that gives any insight.

LOOKUP( MAX( SELECT(Tally_Details[_ROWNUMBER], ([_THISROW-1].[Product_Name] = [Product_Name]) ) ), "Tally_Details", "_ROWNUMBER", "Product_Name" )

I have found that using [_THISROW-0] works perfectly. Not sure why I need the -0, but as long as it works. Thanks.