<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Calculating elapsed business hours in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-elapsed-business-hours/m-p/3562781#M137327</link>
    <description>&lt;P&gt;Here is modified Dax Measure:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NetWorkHours =&lt;BR /&gt;VAR BusinessStartHour = TIME(8, 0, 0) // Set the start of business hours (8:00 AM)&lt;BR /&gt;VAR BusinessEndHour = TIME(18, 0, 0) // Set the end of business hours (6:00 PM)&lt;BR /&gt;VAR StartDate = [OpenedDateTime]&lt;BR /&gt;VAR EndDate = [ClosedDateTime]&lt;/P&gt;&lt;P&gt;VAR NetWorkDays = NETWORKDAYS(StartDate, EndDate)&lt;/P&gt;&lt;P&gt;VAR StartWorkHours =&lt;BR /&gt;IF(&lt;BR /&gt;TIME(HOUR(StartDate), MINUTE(StartDate), SECOND(StartDate)) &amp;lt; BusinessStartHour,&lt;BR /&gt;BusinessStartHour - TIME(HOUR(StartDate), MINUTE(StartDate), SECOND(StartDate)),&lt;BR /&gt;0&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;VAR EndWorkHours =&lt;BR /&gt;IF(&lt;BR /&gt;TIME(HOUR(EndDate), MINUTE(EndDate), SECOND(EndDate)) &amp;gt; BusinessEndHour,&lt;BR /&gt;TIME(HOUR(EndDate), MINUTE(EndDate), SECOND(EndDate)) - BusinessEndHour,&lt;BR /&gt;0&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;VAR NetWorkHours =&lt;BR /&gt;IF(&lt;BR /&gt;NetWorkDays &amp;gt; 0,&lt;BR /&gt;(NetWorkDays - 1) * (BusinessEndHour - BusinessStartHour) + StartWorkHours + EndWorkHours,&lt;BR /&gt;IF(&lt;BR /&gt;StartDate &amp;lt; EndDate &amp;amp;&amp;amp; StartDate &amp;lt;&amp;gt; EndDate,&lt;BR /&gt;StartWorkHours + EndWorkHours,&lt;BR /&gt;0&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;RETURN&lt;BR /&gt;NetWorkHours // Returns the net work hours without rounding&lt;/P&gt;</description>
    <pubDate>Fri, 01 Dec 2023 09:44:51 GMT</pubDate>
    <dc:creator>123abc</dc:creator>
    <dc:date>2023-12-01T09:44:51Z</dc:date>
    <item>
      <title>Calculating elapsed business hours</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-elapsed-business-hours/m-p/3561779#M137290</link>
      <description>&lt;P&gt;Who can help me with this formula?&lt;/P&gt;&lt;P&gt;I’m trying to calculate the business hours that have elapsed between the moment a record has been opened and the moment that record is closed. After receiving error after error I finally have a code that doesn’t give me an error, but is still not showing me the correct numbers. What should the code look like? I'm clearing doing something very wrong (not very experienced yet).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what I have&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NetWorkHours =&lt;BR /&gt;VAR BusinessStartHour = TIME(8;00;00) // Set the start of business hours (8:00 AM)&lt;BR /&gt;VAR BusinessEndHour = TIME(18, 0, 0) // Set the end of business hours (6:00 PM)&lt;BR /&gt;VAR StartDate = [OpenedDateTime]&lt;BR /&gt;VAR EndDate = [ClosedDateTime]&lt;/P&gt;&lt;P&gt;VAR NetWorkDays = NETWORKDAYS(StartDate, EndDate)&lt;/P&gt;&lt;P&gt;VAR StartWorkHours = IF(TIME(HOUR(StartDate), MINUTE(StartDate), SECOND(StartDate)) &amp;lt; BusinessEndHour, BusinessEndHour - TIME(HOUR(StartDate), MINUTE(StartDate), SECOND(StartDate)), 0)&lt;BR /&gt;VAR EndWorkHours = IF(TIME(HOUR(EndDate), MINUTE(EndDate), SECOND(EndDate)) &amp;gt; BusinessStartHour, TIME(HOUR(EndDate), MINUTE(EndDate), SECOND(EndDate)) - BusinessStartHour, 0)&lt;/P&gt;&lt;P&gt;VAR NetWorkHours =&lt;BR /&gt;IF(&lt;BR /&gt;NetWorkDays &amp;gt; 0,&lt;BR /&gt;(NetWorkDays * (BusinessEndHour - BusinessStartHour)) + StartWorkHours + EndWorkHours,&lt;BR /&gt;IF(&lt;BR /&gt;StartDate &amp;gt;= EndDate || StartDate = EndDate,&lt;BR /&gt;0,&lt;BR /&gt;StartWorkHours + EndWorkHours&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;RETURN&lt;BR /&gt;NetWorkHours // Returns the net work hours without rounding&lt;/P&gt;</description>
      <pubDate>Thu, 30 Nov 2023 19:41:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-elapsed-business-hours/m-p/3561779#M137290</guid>
      <dc:creator>Powerbiuser667</dc:creator>
      <dc:date>2023-11-30T19:41:09Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating elapsed business hours</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-elapsed-business-hours/m-p/3562781#M137327</link>
      <description>&lt;P&gt;Here is modified Dax Measure:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NetWorkHours =&lt;BR /&gt;VAR BusinessStartHour = TIME(8, 0, 0) // Set the start of business hours (8:00 AM)&lt;BR /&gt;VAR BusinessEndHour = TIME(18, 0, 0) // Set the end of business hours (6:00 PM)&lt;BR /&gt;VAR StartDate = [OpenedDateTime]&lt;BR /&gt;VAR EndDate = [ClosedDateTime]&lt;/P&gt;&lt;P&gt;VAR NetWorkDays = NETWORKDAYS(StartDate, EndDate)&lt;/P&gt;&lt;P&gt;VAR StartWorkHours =&lt;BR /&gt;IF(&lt;BR /&gt;TIME(HOUR(StartDate), MINUTE(StartDate), SECOND(StartDate)) &amp;lt; BusinessStartHour,&lt;BR /&gt;BusinessStartHour - TIME(HOUR(StartDate), MINUTE(StartDate), SECOND(StartDate)),&lt;BR /&gt;0&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;VAR EndWorkHours =&lt;BR /&gt;IF(&lt;BR /&gt;TIME(HOUR(EndDate), MINUTE(EndDate), SECOND(EndDate)) &amp;gt; BusinessEndHour,&lt;BR /&gt;TIME(HOUR(EndDate), MINUTE(EndDate), SECOND(EndDate)) - BusinessEndHour,&lt;BR /&gt;0&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;VAR NetWorkHours =&lt;BR /&gt;IF(&lt;BR /&gt;NetWorkDays &amp;gt; 0,&lt;BR /&gt;(NetWorkDays - 1) * (BusinessEndHour - BusinessStartHour) + StartWorkHours + EndWorkHours,&lt;BR /&gt;IF(&lt;BR /&gt;StartDate &amp;lt; EndDate &amp;amp;&amp;amp; StartDate &amp;lt;&amp;gt; EndDate,&lt;BR /&gt;StartWorkHours + EndWorkHours,&lt;BR /&gt;0&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;RETURN&lt;BR /&gt;NetWorkHours // Returns the net work hours without rounding&lt;/P&gt;</description>
      <pubDate>Fri, 01 Dec 2023 09:44:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-elapsed-business-hours/m-p/3562781#M137327</guid>
      <dc:creator>123abc</dc:creator>
      <dc:date>2023-12-01T09:44:51Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating elapsed business hours</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-elapsed-business-hours/m-p/3567646#M137541</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="654483" data-lia-user-login="Powerbiuser667" class="lia-mention lia-mention-user"&gt;Powerbiuser667&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;Have you solved your problem? If solved please mark the reply in this post which you think is helpful as a solution to help more others facing the same problem to find a solution quickly, thank you very much!&lt;BR /&gt;If the problem hasn't been solved yet, could you please provide the results you're getting with the DAX you're using and what you're hoping to get, that would be helpful!&lt;BR /&gt;&lt;BR /&gt;Best Regards,&lt;BR /&gt;Dino Tao&lt;/P&gt;</description>
      <pubDate>Tue, 05 Dec 2023 05:46:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-elapsed-business-hours/m-p/3567646#M137541</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-12-05T05:46:41Z</dc:date>
    </item>
  </channel>
</rss>

