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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
ManuApo
Helper II
Helper II

Having trouble to create a counter column by occurrence :(

Hello Comunity, 

Im struggling to create a counter column with DAX where filtering by ID, returns 1, 2, 3, 4...  based on a column date date ( earlier > later ) and when the column Employee Action = 1

This will be an example of my data including also the ideal result: 

IDDateEmployee ActionCounter
100125/01/2012
100123/01/20  
100120/01/2011
100118/01/20  
100203/02/2012
100224/01/20  
100218/01/2011


Having on mind that it could be more than 2 actions per ID and I want to count them chronologically ( earlier > later)


I tried to use an IF statement, also COUNTAX, COUNTX ..... I gave up 😞

Please I would really appreciate if someone can help me here 

Thanks,
Manu

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@ManuApo , Create a new column like

if([Employee Action] =1, rankx(filter(Table, [Employee Action] =1 && [ID] =earlier([ID])), [Date],,asc,dense), blank())

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@ManuApo , Create a new column like

if([Employee Action] =1, rankx(filter(Table, [Employee Action] =1 && [ID] =earlier([ID])), [Date],,asc,dense), blank())

AMAZINGGG!!! 

Thank you so much @amitchandak

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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