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.
Dear Experts,
I want to calculate hours between 2 dates , CreationDate and CompletionDate
Will be very very great if you can do it for me as I am unable to do this as not much expert and think that level.
Please download Test Data and PBIX for below link.
https://www.transfernow.net/dl/20211204nDhVs72D
Solved! Go to Solution.
@Anonymous check this video that talks about a similar question.
✨ Follow us on LinkedIn
Learn about conditional formatting at Microsoft Reactor
My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡ Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
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.
Hi @Anonymous ,
Please try this code
WorkHour =
VAR _allmin =
GENERATESERIES(
MAX( 'Test Data'[Creation Date] ),
MAX( 'Test Data'[Completion Date] ),
1 / 1440
)
VAR _workmin =
FILTER(
ADDCOLUMNS(
_allmin,
"workday", WEEKDAY( [Value], 2 ),
"worktime",
IF( AND( HOUR( [Value] ) >= 9, HOUR( [Value] ) <= 17 ), 1, BLANK() )
),
[workday] < 6
&& [worktime] = 1
)
RETURN
COUNTROWS( _workmin ) / 60
Result:
Need more attention:
Your created time is text from you provided pbix file, you should change it to date/time type. I recommend use the power query edito to shape it.
PBIX file in the end you can refer.
Best Regards
Community Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
I know this is already solved so I'm just leaving this here for the future in hope it might help someone in the future 🙂
https://www.villezekeviking.com/calculating-handling-time-during-office-hours/
Dear @parry2k ,
I have applied all the steps as per directions given in your video but my hours calculaitons seems incorrect. For example -
I have created 1 ticket on 29-Oct-2021 09:55:00 AM , and closed it on 03-Nov-2021 10:00:00 AM then if I consider my working hours as below -
Start - 08:00:00 AM
End - 05:00:00 PM
Exclude - Sat and Sun
Then total hours should be -
29-Oct (Thu) - 7 Hours
30-Oct (Fri) - 9 Hours
31-Oct (Sat) - 0 Hours
01-Nov (Sun) - 0 Hours
02-Nov (Mon) - 9 Hours
03-Nov (Tue) - 2 Hours, Then total hours should be ~27 Hours. But as per calculation it is showing 18.1 hours.
Below is the Measure that I have created :
Hi @Anonymous ,
Please try this code
WorkHour =
VAR _allmin =
GENERATESERIES(
MAX( 'Test Data'[Creation Date] ),
MAX( 'Test Data'[Completion Date] ),
1 / 1440
)
VAR _workmin =
FILTER(
ADDCOLUMNS(
_allmin,
"workday", WEEKDAY( [Value], 2 ),
"worktime",
IF( AND( HOUR( [Value] ) >= 9, HOUR( [Value] ) <= 17 ), 1, BLANK() )
),
[workday] < 6
&& [worktime] = 1
)
RETURN
COUNTROWS( _workmin ) / 60
Result:
Need more attention:
Your created time is text from you provided pbix file, you should change it to date/time type. I recommend use the power query edito to shape it.
PBIX file in the end you can refer.
Best Regards
Community Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@v-chenwuz-msft , I am getting below error while applied your givebn formula.
Hi @Anonymous ,
Does it work if your add columns [Created Date with time] and [Custom field (Completion Timestamp)] ? Maybe you do not add relationships between 'Jira Raw data' table and the table where [Discripiton] comes from.
Best Regards
Community Support Team _ chenwu zhu
Dear @Syndicate_Admin , I am have tried it but not working. I am attaching my pbix file here. Kindly help me to get solution of it. Thanks a lot
https://sendgb.com/VYCO7SxJhsa
Dear @Syndicate_Admin , thanks a lot for helping. This is perfectly working for me. 🙂
@Anonymous check this video that talks about a similar question.
✨ Follow us on LinkedIn
Learn about conditional formatting at Microsoft Reactor
My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡ Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
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.
Dear @parry2k ,
Thanks to guide me and helped me to resolve my query. I did step by step with help of video and it works for me what I wanted. Below is the calculation of Measure That I implemented-
@Anonymous well done, and thanks for sharing the solution with the community so that others can take advantage of it.
Good luck!
✨ Follow us on LinkedIn
Learn about conditional formatting at Microsoft Reactor
My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡ Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
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.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
107 | |
93 | |
77 | |
65 | |
53 |
User | Count |
---|---|
147 | |
106 | |
104 | |
87 | |
61 |