Reputation: 873
Suppose that you have a table with two columns ("ID","DATETIME"). For each "ID" there are multiple rows with different datetimes. I want to create a third column named "IS_LAST" which has a Boolean data type. For each row I want to filter the table with the "ID" present in the row and want to check if the "DATETIME" in row is the latest. If yes, "IS_LAST" goes to TRUE else FALSE.
My tentative is: IF(COUNTROWS(FILTER(TABLE, TABLE[ID] = [ID] && TABLE[DATETIME] > [DATETIME]) = 0)), TRUE, FALSE)
. But this gives TRUE for all rows.
Upvotes: 0
Views: 1197
Reputation: 30264
Is Last =
VAR latest = CALCULATE(MAX('Table'[time]), ALLEXCEPT('Table','Table'[id]))
RETURN
IF(SELECTEDVALUE('Table'[time]) = latest, TRUE())
Upvotes: 1