Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 12890

Distinct Cummulative count

$
0
0

I need to calculate the distinct Cummulative count for the incremental months

As shown below

Month PersonName
7 sam
7 kim
7 tim
8 sam
8 tom
8 rex
8 ram
9 sam
10 Rob

o/p :

Month CountPerMonth DistinctCummulativeCount
7 3  3
8 4  6
9 1  6
10 1  7

CountPerMonth=count for respective month

DistinctCummulativeCount=column should give distinct count for the months in (7),(7,8),(7,8,9), (7,8,9,10) respectively.

Appreciate your help..

Thanks.


Viewing all articles
Browse latest Browse all 12890

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>