How to pick up records by taking last record in each group

Microsoft
I am trying to implement similar logic as sql 
select * from 
(select ROW_NUMBER() OVER(
       ORDER BY ColumnName desc) AS RowNum
From TableName) temp
where RowNum=1
 
How i can achieve this in azure data explorer
I have tried this
MsCdrView()
| reduce by CallRetryId  with threshold=0.9
But this only gives me occurrences of CallRetryId in my table with pattern matching
 But if there are multiple rows i want to select the latest row in each group.
 
 
1 Reply

generally speaking, getting the "last" record in each group can be achieved using "summarize arg_max(..)" or "summarize arg_min(..)".
If you'd interested in providing a sample data set (e.g. using the "datatable" operator), this forum could assist with authoring the query.

relevant links for operators/functions mentioned above:

- https://docs.microsoft.com/en-us/azure/kusto/query/arg-max-aggfunction 

- https://docs.microsoft.com/en-us/azure/kusto/query/arg-min-aggfunction

https://docs.microsoft.com/en-us/azure/kusto/query/datatableoperator