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
PeterCyos
Frequent Visitor

Cummulative count for laboral days worked

Hi everybody!

I am trying to make an accumulated sum of the days that an employee has worked in a row, but I need it to restart and not count the weekends, that's why I have a table similar to this one.

I have created a table with the columns I have, (Days, Name, Labor day, Worked?) and the result I would like to have (Days in a row).

 

Days NameLabor dayWorked?Days in a row
01/01/2023Frankfalsefalse0
02/01/2023Franktruetrue1
03/01/2023Franktruetrue2
04/01/2023Franktruetrue3
05/01/2023Franktruetrue4
06/01/2023Franktruetrue5
07/01/2023Frankfalsefalse5
08/01/2023Frankfalsefalse5
09/01/2023Franktruetrue6
10/01/2023Franktruetrue7
11/01/2023Franktruetrue8
01/01/2023Garyfalsefalse0
02/01/2023Garytruetrue1
03/01/2023Garytruetrue2
04/01/2023Garytruefalse0
05/01/2023Garytruetrue1
06/01/2023Garytruetrue2
07/01/2023Garyfalsefalse2
08/01/2023Garyfalsefalse2
09/01/2023Garytruetrue3
10/01/2023Garytruetrue4
11/01/2023Garytruetrue5

 

 

I leave here the example of what I have done so far in case it can help.

Var Counter = 

 SUMX(FILTER( BBDD, BBDD[employeeId] = EARLIER(BBDD[employeeId]) && BBDD[dates] <= EARLIER(BBDD[dates]) && (EARLIER(BBDD[worked])=True() ), BBDD[Worked] )
Return if( BBDD[Worked]=true() && BBDD[Labor day] =true(), counter,
 if( BBDD[Worked]=false() && BBDD[Labor day]=true, counter-counter)

Thanks in anycase!

1 REPLY 1
johnt75
Super User
Super User

I think you can use or adapt the technique in https://www.youtube.com/watch?v=8M8mgfZsTS0 

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.