Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
I have a table with 3 line and after each work order, the time used is recorded in the table. I want to count the number of shift used per day based on the hours used. If the usage is more than 12 hours, than another shift is added.
I am able to count the number of shift used per day (in the color column) but
I am unable to count the total number of shift used . it keep returning total of 2 shift used
Solved! Go to Solution.
@PatrickWong try following measure, but one thing is not clear in your example, how come # of hrs = 12 is 2 shift, it should be one, no? Jan 2, line 2, 12 hours and you are showing shift = 2
Shift Count1 =
SUMX (
SUMMARIZE (
hrs,
hrs[Month],
hrs[Line]
),
CEILING (
DIVIDE (
CALCULATE(
SUM (
hrs[Hrs]
)
),
12
),
1
)
)
here is the output . Would appreciate Kudos 🙂 if my solution helped.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Please look at your example again. You state you expect the total to be 14, but there is an ERROR in your reasoning as explained by Parry2K in the first reply.
Look at the second line. Then look at your statement when the hrs within the shift is between 1-12 hrs, the shift is 1. That doesn't seem to be correct in your picture of the desired output.
Please explain clearly why the provided solution is incorrect and if so, what statement is incorrect of you (your 12hours=1 statement or your picture in your opening post).
Thanks.
Kind regards
Djerro123
-------------------------------
If this answered your question, please mark it as the Solution. This also helps others to find what they are looking for.
Keep those thumbs up coming! 🙂
Proud to be a Super User!
The expected result should be 14 as total number of shift. Some of the suggested solution cames backas 13 shift which is not correct.
attached is the file contains the file of my problem
https://1drv.ms/u/s!AtNffqDpLdovao--DhU7cDKIcVg?e=oYceog
Proud to be a Super User!
Hi Djerro123,
what I meant was that when the hrs within the shift is between 1-12 hrs, the shift is 1. when the hrs is more than 12 hrs, then the shift becomes 2.
Please look at your example again. You state you expect the total to be 14, but there is an ERROR in your reasoning as explained by Parry2K in the first reply.
Look at the second line. Then look at your statement when the hrs within the shift is between 1-12 hrs, the shift is 1. That doesn't seem to be correct in your picture of the desired output.
Please explain clearly why the provided solution is incorrect and if so, what statement is incorrect of you (your 12hours=1 statement or your picture in your opening post).
Thanks.
Kind regards
Djerro123
-------------------------------
If this answered your question, please mark it as the Solution. This also helps others to find what they are looking for.
Keep those thumbs up coming! 🙂
Proud to be a Super User!
You need a new shift of 12 too
new 1= CEILING(divide(sum(Sheet1[Hrs]),11.9),1))
Or if want GT to also match
new 1 =
SUMX(SUMMARIZE(Sheet1,Sheet1[Date],Sheet1[Line],"S1",CEILING(divide(sum(Sheet1[Hrs]),11.9),1)),[S1])
Refer
https://www.dropbox.com/s/ujyf4tcex4a2xux/test%20shift.pbix?dl=0
Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...
https://community.powerbi.com/t5/Community-Blog/Power-BI-Working-with-Non-Standard-Time-Periods/ba-p...
https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601
Hi @PatrickWong ,
The total of 2 in the Total row is evaluated just like every line above it. It isn't just a summation when the column is a measure. Can you share your DAX of measure [Shifts]? Also, could you share your data in a table format? (that way, we can reproduce your situation easily and figure out a solution for you 🙂 )
Kind regards
Djerro123
-------------------------------
If this answered your question, please mark it as the Solution. This also helps others to find what they are looking for.
Keep those thumbs up coming! 🙂
Proud to be a Super User!
You can try this as Shifts measure:
Shifts =
VAR tmpTable = SUMMARIZE('Table', 'Table'[Date], 'Table'[Line], "Shifts", ROUNDUP(DIVIDE(SUM('Table'[Hours]), 12), 0))
RETURN
SUMX(tmpTable, [Shifts])
results are this:
Kind regards
Djerro123
-------------------------------
If this answered your question, please mark it as the Solution. This also helps others to find what they are looking for.
Keep those thumbs up coming! 🙂
Proud to be a Super User!
@PatrickWong try following measure, but one thing is not clear in your example, how come # of hrs = 12 is 2 shift, it should be one, no? Jan 2, line 2, 12 hours and you are showing shift = 2
Shift Count1 =
SUMX (
SUMMARIZE (
hrs,
hrs[Month],
hrs[Line]
),
CEILING (
DIVIDE (
CALCULATE(
SUM (
hrs[Hrs]
)
),
12
),
1
)
)
here is the output . Would appreciate Kudos 🙂 if my solution helped.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.