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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
babyjb1979
Helper I
Helper I

The max consecutive work days

Hi,

 

I am asked to create a calculation of employee consecutive work days. For specific period, want to see every employee's max consecutive work days. I am trying to write a measure, but stuck. Please help! 

Consecutive Work Days =
var tb0=
ADDCOLUMNS(
SUMMARIZE('Employee Transaction','Employee Transaction'[Employee Number],'Employee Transaction'[Work Date]),"Consecutive Days",
IF(ISINSCOPE('Employee Transaction'[Employee Number]),
var tb1=CALENDAR(FIRSTDATE('Date'[Date]),LASTDATE('Date'[Date]))
var tb2=EXCEPT(tb1,ALL('Employee Transaction'[Work Date]))
var tb3=MAX('Date'[Date])
var tb4=MAXX(FILTER(tb2,[Date]<=tb3),[Date])
Return
INT(tb3-tb4)))
Return
tb0

 

 

Employee IDWork Date
A1/1/2023
A1/2/2023
A1/3/2023
B1/7/2023
A1/5/2023
A1/6/2023
A1/7/2023
A1/8/2023
B1/10/2023
A1/9/2023
A1/10/2023
A1/20/2023
B1/22/2023
A1/21/2023
A1/22/2023
A1/23/2023
B1/23/2023
B1/24/2023
A1/24/2023
A1/25/2023
A1/26/2023
A1/27/2023
B1/28/2023
B1/29/2023
B1/30/2023
B1/31/2023
B2/1/2023
B2/2/2023
3 REPLIES 3
technolog
Super User
Super User

I hope this message finds you well. I've noticed that this solution remain unresolved. If any of you have managed to find a resolution to the issue, I kindly request that you share your solution for the benefit of the entire community. Alternatively, if you're still facing challenges, please do let us know as well.

Your insights and updates will greatly assist others who might be encountering the same challenge.

Greg_Deckler
Community Champion
Community Champion

@babyjb1979 This might help, it was created for something similar. Cthulhu - Microsoft Fabric Community



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

But your method is when the index column is ready. My situation is no new column can be added into the dataset. Is there a way to resolve just by DAX?

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.