HELP! Slice to get the last record from a group of rows

Hi, community,

I’m trying to create a slice of table “Inspections” to get the last inspection recorded for each rego, but only if that inspection’s status is due or overdue.

So it would be something like:

  1. Filter [rego]
  2. Select rows where [Status] equals “Due” or “Overdue.”
  3. Select the record with the recent date

I have tried different expressions, but none of them has given the expected result.

The last try I did was create a slice “Rows_Due_Overdue” to get all the rows where [Status] equals “Due” or “Overdue” and then create a second slice “Recent_Record” to get the MAX record. The expression I have for “Recent_Record” where “Inspections” is the source table is the following:

IN([ID], SELECT(
Rows_Due_Overdue[ID],
([_ROWNUMBER] = MAX(Rows_Due_Overdue[_ROWNUMBER]))
)
)

It’s not working :tired_face: and I do not know what else to try :frowning:

It would be great if I can get some help, please, pleeease!

Thanks in advanced!

1 Like

If I have understood the requirement correctly, you could try a slice filter expression something like below

IN([ID], LIST(MAXROW(“Table Name”, “Date Column Name”, AND( [rego]=[_THISROW].[rego] , OR([Status]=“Due”, [Status]=“Overdue”)))))

5 Likes

You are a genius! :slight_smile: thank you!

3 Likes