Do you really need FirstSorted value to achieve it? As I understand you want full row based on Max Dated per ID so inner join solution would be handy. If you really want
Also, I found some issue in your date format hence I modified its format in the original example.
You can try something like below if you wanted to go FirstSortedValue way.
Test1: load [id name], FirstSortedValue(Distinct city, -id_date) as city ,FirstSortedValue(id_date, -id_date) as id_date ,FirstSortedValue(amount, -id_date) as amount Group by [id name] ; LOAD * INLINE [ id name , city , id_date , amount James, Munich , 09/09/2017, 3 John , Cologne , 12/03/2017, 23 John , Cologne , 25/12/2017, 12 ];
Hope it helps!