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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
kaio12foguim
New Member

accumulated, stacking

Hi guys, I have a problem and I can't solve it.

I need to make a line graph, with data stacked, accumulated, like a queuing theory.

 

kaio12foguim_0-1661974244333.png

--------------------------------------

this data refers to team shifts,

example: I have a monthly shift table

name

start shift

end shift

 

namestart shiftend shift
kaio06:0015:00
joao06:0016:00
marcos07:0018:00
felipe07:0019:00

I have the shift table, and I have a 1 in 1 hour table that I use as a filter.

example:

hour
00:00
...
06:00
...
15:00
...
00:00

in the data model, shift table shift start and time table hours fields are linked,
powerbi doesn't allow linking end of shift field in shift table to time field of timetable together

kaio12foguim_2-1661976112234.png

 

 

I'm trying to create a graph that shows the number of teams that there were at each hour, including those that entered and those that left.

 

I already managed to make the data stacked, but it stacks until the last hour, and the big problem is that I can't count the shifts that are ending

 

the code -

measure entry = COUNT('shift'[hour start])

kaio12foguim_3-1661976434838.png

measure exit = COUNT('shift'[hour exit]) -- here in I already have a problem, I put it to count by the end of shift field, but it returns the same start values, because in model the linked fields are the start of shift of the shift table in the hours field of the time table

kaio12foguim_4-1661976654891.png

 

measure accumulated =

var accumulateentry = CALCULATE(COUNT(shift[start shift]), FILTER(ALL(hour), hour[hour]<=MAX(hour[hour])))
return acucumulateentry 
kaio12foguim_5-1661976885775.png

the big problem I see is that I can't count the finished shifts, because in the model tab the fields that are being used to link a table at the time is the start of shift field, I've already tested inverting and putting the end of shift field , then I get the end of shift times, but I can't get count the start times anymore, it has to be one or the other

 

 I already tried to use the measure code CALCULATE(SELECTEDVALUE('shift'[hour end]), CROSSFILTER('shift'[hour end],'hours'[hour],Both)), but it doesn't work

 

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@kaio12foguim , You need the same approach with hour table one that has been done with a date here in this blog , refer current employee

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@kaio12foguim , You need the same approach with hour table one that has been done with a date here in this blog , refer current employee

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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.