Forum Discussion

Oskar's avatar
Oskar
Helper I
2 years ago
Solved

Sort table on last - shows wrong result

I have a table that looks like this   Status (TEXT) Date (Date and Time) Customer (TEXT) Active 2024-05-17 11:30:49 Customer A Inactive 2024-05-17 09:27:12 Customer A   In pow...
  • vicky_'s avatar
    2 years ago

    It's because it's displaying the "Last" value alphabetically, rather than by the status time. You need to use a measure in this case to grab the latest status (and customer too!) The reason the date works is because it is technically stored as a number - so it makes sense to grab the biggest number in the series of dates.

     

    Here's the measure i used to grab the latest status - you can easily modify to grab the latest customer:

    Latest Status = CALCULATE(MAX('Table (2)'[Status (TEXT)]), 'Table (2)'[Date (Date and Time)] = MAX('Table (2)'[Date (Date and Time)]))