Initial Value based on Max [Timestamp]

Hi.

I have a column [AM/PM Charge] in Table Operations_Master_Check and I want the initial value of this to be the same as the row in the table with the MAX() [Pre-Treatment Timestamp]. This MAX() timestamp is not necessarily the maximum row in the table so I cannot use MAXROW(). I tried a virtual column with App Formula MAX(SELECT(Operations_Master_Check[Pre-Treatment Timestamp],TRUE,TRUE)) and set the initial value in the [AM/PM Charge] column to [Max Pre-Treatment Timestamp].[AM/PM Charge] but I am getting the following error.

Column Name ‘AM/PM Charge’ in Schema ‘Operations_Master_Check_Schema’ of Column Type ‘Enum’ has an invalid Initial Value of ‘=[Max Pre-Treatment Timestamp].[AM/PM Charge]’. Error in expression [Max Pre-Treatment Timestamp].[AM/PM Charge]

Any help in the right direction on this would be great, thank you.

So how are you identifying it then?

This expression can be reduced to just:

MAX( Operations_Master_Check[Pre-Treatment Timestamp] )

Is [Pre-Treatment Timestamp] the key column of this table?

2 Likes

Thank you @Marc_Dillon

  1. When I edit an existing record (the entire record is broken up into different slices) I want the Initial Values of some of the fields to be set to the same values as the record with the highest [Pre-Treatment Timestamp] value in the table.

  2. I had that alternative expression in as well. I assume either is ok?

  3. No [Pre-Treatment Timestamp] is not the key value.

Ok, sure. Just the way you said it before made me think it wasn’t just a straight-forward MAX(). Are you wanting it to only be the max in the current slice?

Yah they do the exact same thing.

Ok, then “[Max Pre-Treatment Timestamp].[AM/PM Charge]” is not going to work. This is a dereference expression, the column before the period needs to be a Ref-type column, which you shouldn’t have if this column was built off of the [Pre-Treatment Timestamp] value.

There are multiple ways to get this value. I’m not currently coming to a conclusion as to which is best, but this should work.

LOOKUP(
MAX( Operations_Master_Check[Pre-Treatment Timestamp] ),
“Operations_Master_Check”,
“Pre-Treatment Timestamp”,
“AM/PM Charge”
)

2 Likes

Thanks a million @Marc_Dillon.

I will test your suggestion.