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
babyjb1979
Helper I
Helper I

Calculation for consecutive work days for employee

Hi all,

 

I am creating a measure to calculate the consecutive work days for every employee. The table has columns including [Employee ID],[Work Date]

I extact an employee as test, I already make it using following DAX: (One employee's data as a new data source)

Consecutive Work Days =
var tb1=MAX('Date'[Date])
var tb2=ALL('Date'[Date])
var tb3=ALL('Work'[Work Date])
var tb4=EXCEPT(tb2,tb3)
var tb5=MAXX(FILTER(tb4,[Date]<=tb1),[Date])
Return
INT(tb1-tb5)
babyjb1979_0-1693327570564.png

Now, I want to apply the DAX to all employees:

Consecutive Work Days 1 =
CALCULATE(
var tb0=SUMMARIZE('Employee Transaction','Employee Transaction'[Work Date])
var tb1=MAX('Date'[Date])
var tb2=ALL('Date'[Date])
var tb3=EXCEPT(tb2,tb0)
var tb4=MAXX(FILTER(tb3,[Date]<=tb1),[Date])
Return
INT(tb1-tb4),
FILTER('Employee Transaction','Employee Transaction'[Employee Number]=EARLIER('Employee Transaction'[Employee Number]))
)
babyjb1979_1-1693327770893.png

I don't know what the reason leading to the error. Could you please help me out?

 

Thank you in advance!

Branko

2 REPLIES 2
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.

babyjb1979
Helper I
Helper I

No one knows the solution?

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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