Skip to content
Advertisement

Find cumulative sum of insurance sales amount with increasing date while considering unique salesman names count

I have the following table

I want to find the date-wise cumulative SalesAmount, while also maintaining the increasing count of salesman names that come into the table.

So basically the task is to eliminate the duplicate names, that may occur on the daily basis, or in a cumulative fashion?

Advertisement

Answer

You can use a window function to get the first date a sales person appears. Then use aggregation and a cumulative sum:

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement