Running Count by Category in POWER PIVOT Data Model

Copper Contributor

Hello,

 

I am having a Table with timestamps (TS) and categories (UserID) and want to create an additional column (EventID) with an ID that is runs from 1 to n(UserID) individually for each category:

 

TS       UserID     EventID <- to be calculated

01:12  00001      001

01:14  00001      002

01:15  00001      003

01:11  00002      001

01:14  00002      002

01:16  00002      003

 

My current attempt looks like this, but the calculation doesn't run through and the program stops responding:

 

 

=CALCULATE
(
count([UserID]),
filter(
         ALLEXCEPT('DB', 'DB'[UserID]),
         [TS] <= earlier([TS])
       )
)

 

 

I have something of about 330k rows, but I'd like it to be able to handle more than that.

 

In case it's not obvious, I'm rather new at this and google most of my code. Thanks a lot in advance for your help!

0 Replies