How do you handle duplicate records in a table when performing aggregations? Write a query using window functions to deduplicate a dataset.