cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ManuApo
Frequent Visitor

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 IV
Super User IV

@ManuApo , Create a new column like

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



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

View solution in original post

2 REPLIES 2
amitchandak
Super User IV
Super User IV

@ManuApo , Create a new column like

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



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

View solution in original post

AMAZINGGG!!! 

Thank you so much @amitchandak

Helpful resources

Announcements
User Groups Public Preview

Join us for our User Group Public Preview!

Power BI User Groups are coming! Make sure you’re among the first to know when user groups go live for public preview.

March Update

Check it Out!

Click here to read more about the March 2021 Updates!

secondImage

The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.