SQLDAXExcelPython
Leaderboard
groupby and mergeMedium20 points

Keep the latest row per key

For each customer with sales, set result to CustomerId and SaleId of their latest sale. Use OrderDate, and on a tie take the highest SaleId.

Show solutionLifetime

Real Python running in your browser through Pyodide, with pandas available. Nothing you type is sent to a server unless you save a score.

Python
Loading editor…

Press Ctrl+Enter or Run to see the result here.