Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
ebuchholz
Frequent Visitor

Running count of reoccurring values in a column ordered by another column

Is there a way I can get a running count based on a reoccuring value in a column, and start a new running count based on new values? Please see the example below for what I am trying to achieve. When defining where to start counting, the data would most likely be sorted by a date column. Thank you!

 

IDDesired Output
A1
A2
A3
A4
A5
B1
B2
B3
B4
C1
C2
C3
D1
D2
D3
D4
E1
E2
E3
E4
E5
C4
A6
A7
2 REPLIES 2
v-sihou-msft
Microsoft Employee
Microsoft Employee

@ebuchholz

 

According to your description, you are actually need to create a Rank column based on a date column within each ID group. Right?

 

You can create a calculated column like below:

 

RankWithinGroup Column =
RANKX (
    FILTER ( Table, Table[ID] = EARLIER ( Table[ID] ) ),
    Table[Date],
    ,
    ASC,
    DENSE
)

4.PNG

Regards,

Can this be done in the edit queries screen as a column with new values? Ideally I would like to use this value to create a new key for the table it resides in.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.