<?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: Calculate Working Hours excl Weekends &amp;amp; Holidays in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Working-Hours-excl-Weekends-amp-Holidays/m-p/2599679#M75112</link>
    <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;BR /&gt;Where is the data for weekends and holidays?&lt;/P&gt;</description>
    <pubDate>Fri, 24 Jun 2022 07:20:05 GMT</pubDate>
    <dc:creator>tamerj1</dc:creator>
    <dc:date>2022-06-24T07:20:05Z</dc:date>
    <item>
      <title>Calculate Working Hours excl Weekends &amp; Holidays</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Working-Hours-excl-Weekends-amp-Holidays/m-p/2599535#M75107</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I have the following travelling data for vehicles where I need to calculate actual travel hours excluding weekends and holidays.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Considering Standard workings hours from 8:00 AM to 6:00 PM.&lt;/P&gt;&lt;P&gt;Request to help in this..&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;First Start Time&lt;/TD&gt;&lt;TD&gt;Last Stop Time&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01-Apr-2022 07:41:26 AM&lt;/TD&gt;&lt;TD&gt;31-May-2022 04:41:07 PM&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01-Apr-2022 09:03:47 AM&lt;/TD&gt;&lt;TD&gt;31-May-2022 06:29:15 PM&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01-Apr-2022 06:09:36 AM&lt;/TD&gt;&lt;TD&gt;31-May-2022 05:55:29 PM&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;04-Apr-2022 02:41:09 PM&lt;/TD&gt;&lt;TD&gt;31-May-2022 07:00:30 PM&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01-Apr-2022 08:08:56 AM&lt;/TD&gt;&lt;TD&gt;31-May-2022 06:28:53 PM&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;07-Apr-2022 08:59:19 AM&lt;/TD&gt;&lt;TD&gt;31-May-2022 05:10:01 PM&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01-Apr-2022 12:01:36 PM&lt;/TD&gt;&lt;TD&gt;31-May-2022 07:09:00 PM&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01-Apr-2022 07:34:28 AM&lt;/TD&gt;&lt;TD&gt;31-May-2022 06:31:49 PM&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2022 06:25:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Working-Hours-excl-Weekends-amp-Holidays/m-p/2599535#M75107</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-24T06:25:14Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Working Hours excl Weekends &amp; Holidays</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Working-Hours-excl-Weekends-amp-Holidays/m-p/2599651#M75109</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here a similar thread. You can find various other links in there that I am sure will be helping you!&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Desktop/Working-days-between-two-dates-simply/m-p/94172" target="_blank" rel="noopener"&gt;Working days between two dates - simply! - Microsoft Power BI Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And here a video with a function in Power Query:&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.youtube.com/watch?v=bs3yzmf9elA" target="_blank" rel="noopener"&gt;PowerBI: Calculate business/working days between two dates in a new column - YouTube&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know if this helps &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/Tom&lt;BR /&gt;&lt;A href="https://www.tackytech.blog/" target="_blank" rel="noopener"&gt;https://www.tackytech.blog/&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://www.instagram.com/tackytechtom/" target="_blank" rel="noopener"&gt;https://www.instagram.com/tackytechtom/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2022 07:05:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Working-Hours-excl-Weekends-amp-Holidays/m-p/2599651#M75109</guid>
      <dc:creator>tackytechtom</dc:creator>
      <dc:date>2022-06-24T07:05:44Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Working Hours excl Weekends &amp; Holidays</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Working-Hours-excl-Weekends-amp-Holidays/m-p/2599679#M75112</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;BR /&gt;Where is the data for weekends and holidays?&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2022 07:20:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Working-Hours-excl-Weekends-amp-Holidays/m-p/2599679#M75112</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-06-24T07:20:05Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Working Hours excl Weekends &amp; Holidays</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Working-Hours-excl-Weekends-amp-Holidays/m-p/2599959#M75118</link>
      <description>&lt;P&gt;&amp;nbsp;Anonymous&lt;/LI-USER&gt;&lt;/P&gt;&lt;P&gt;Here is a sample file with the solution&lt;/P&gt;&lt;P&gt;As the holidays data is not available the following code consideres only weekends (Saturdays and Sundays). Also late start and early stop are also considred. All calculations are curried out over minutes level then converted to HH:MM format&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Working Hours HH:MM = 
VAR Result =
    SUMX ( 
        WorkingHours,
        VAR CurrentStartDate = WorkingHours[First Start Time]
        VAR CurrentStopDate = WorkingHours[Last Stop Time]
        VAR StandardStartDate = DATE ( YEAR ( CurrentStartDate ), MONTH ( CurrentStartDate ), DAY ( CurrentStartDate ) ) + TIME ( 8, 0, 0 )
        VAR StandardEndDate = DATE ( YEAR ( CurrentStopDate ), MONTH ( CurrentStopDate ), DAY ( CurrentStopDate ) ) + TIME ( 18, 0, 0 )
        VAR LateStartMinutes = IF ( CurrentStartDate &amp;gt; StandardStartDate, DATEDIFF ( StandardStartDate, CurrentStartDate, MINUTE ), 0 )
        VAR EarlyStopMinutes = IF ( CurrentStopDate &amp;lt; StandardEndDate, DATEDIFF ( CurrentStopDate, StandardEndDate, MINUTE ), 0 )
        VAR AllDays = CALENDAR ( CurrentStartDate, CurrentStopDate )
        VAR AllWorkingDays = FILTER ( AllDays, NOT ( WEEKNUM ( [Date], 2 ) IN { 6, 7 } ) )
        VAR WorkedMinutes = COUNTROWS ( AllWorkingDays ) * 600
        VAR NetWorkedMinutes = WorkedMinutes - LateStartMinutes - EarlyStopMinutes
        RETURN
            NetWorkedMinutes
    )
RETURN
    FORMAT ( QUOTIENT ( Result, 60 ), "#,#" ) &amp;amp; " Hours &amp;amp; " &amp;amp; FORMAT ( MOD ( Result, 60 ), "00" ) &amp;amp; " Minutes"&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 24 Jun 2022 08:52:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Working-Hours-excl-Weekends-amp-Holidays/m-p/2599959#M75118</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-06-24T08:52:16Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Working Hours excl Weekends &amp; Holidays</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Working-Hours-excl-Weekends-amp-Holidays/m-p/2600224#M75128</link>
      <description>&lt;P&gt;hii&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Weekends are on Saturday &amp;amp; Sunday&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And holidays from&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;02/05/2022 Monday to 06/05/2022 Firday&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2022 10:00:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Working-Hours-excl-Weekends-amp-Holidays/m-p/2600224#M75128</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-24T10:00:15Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Working Hours excl Weekends &amp; Holidays</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Working-Hours-excl-Weekends-amp-Holidays/m-p/2600267#M75132</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;BR /&gt;Here is the updated sample file&amp;nbsp;&lt;A href="https://we.tl/t-IJwSL1qGc5" target="_blank"&gt;https://we.tl/t-IJwSL1qGc5&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Working Hours = 
VAR Result =
    SUMX ( 
        WorkingHours,
        VAR CurrentStartDate = WorkingHours[First Start Time]
        VAR CurrentStopDate = WorkingHours[Last Stop Time]
        VAR StandardStartDate = DATE ( YEAR ( CurrentStartDate ), MONTH ( CurrentStartDate ), DAY ( CurrentStartDate ) ) + TIME ( 8, 0, 0 )
        VAR StandardEndDate = DATE ( YEAR ( CurrentStopDate ), MONTH ( CurrentStopDate ), DAY ( CurrentStopDate ) ) + TIME ( 18, 0, 0 )
        VAR LateStartMinutes = IF ( CurrentStartDate &amp;gt; StandardStartDate, DATEDIFF ( StandardStartDate, CurrentStartDate, MINUTE ), 0 )
        VAR EarlyStopMinutes = IF ( CurrentStopDate &amp;lt; StandardEndDate, DATEDIFF ( CurrentStopDate, StandardEndDate, MINUTE ), 0 )
        VAR AllDays = CALENDAR ( CurrentStartDate, CurrentStopDate )
        VAR AllWorkingDays = FILTER ( AllDays, NOT ( WEEKNUM ( [Date], 2 ) IN { 6, 7 } ) &amp;amp;&amp;amp; NOT ( [Date] IN VALUES ( Holidays[Date] ) ) )
        VAR WorkedMinutes = COUNTROWS ( AllWorkingDays ) * 600
        VAR NetWorkedMinutes = WorkedMinutes - LateStartMinutes - EarlyStopMinutes
        RETURN
            NetWorkedMinutes
    )
RETURN
    FORMAT ( QUOTIENT ( Result, 60 ), "#,#" ) &amp;amp; " Hours &amp;amp; " &amp;amp; FORMAT ( MOD ( Result, 60 ), "00" ) &amp;amp; " Minutes"&lt;/LI-CODE&gt;&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2022 10:11:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Working-Hours-excl-Weekends-amp-Holidays/m-p/2600267#M75132</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-06-24T10:11:59Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Working Hours excl Weekends &amp; Holidays</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Working-Hours-excl-Weekends-amp-Holidays/m-p/2601384#M75189</link>
      <description>&lt;P&gt;Thank you the video was a great help, im trying to create a column with the data from the querey now to work out how many working day each person had had off in total.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;work days = &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'DaysOff (2)'[Days off work]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;ALLEXCEPT&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'DaysOff'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;'DaysOff (2)'[UniqueID]&lt;/SPAN&gt;&lt;SPAN&gt;))+&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;On the datediF column&amp;nbsp; that works out the calendar days off, the formula above adds up all of the days into one cell for me. I want both to be in a table the days off from a specific absence then the total days the person has taken off in total too in the same row.&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;eg.&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;B Boo = 3&amp;nbsp; &amp;nbsp;12&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;B Boo = 6&amp;nbsp; &amp;nbsp;12&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;B Boo = 3&amp;nbsp; &amp;nbsp;12&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 24 Jun 2022 20:57:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Working-Hours-excl-Weekends-amp-Holidays/m-p/2601384#M75189</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-24T20:57:29Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Working Hours excl Weekends &amp; Holidays</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Working-Hours-excl-Weekends-amp-Holidays/m-p/2601390#M75190</link>
      <description>&lt;P&gt;Probaly not the correct way to resolve this,excuse me as im new to PBI.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I made a help column out of the querey column using value to chnage the number to text, then used my formula and it worked. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;DIV&gt;&lt;SPAN&gt;work days =&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'DaysOff (2)'[Days off work]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;ALLEXCEPT&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'DaysOff'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;'DaysOff (2)'[UniqueID]&lt;/SPAN&gt;&lt;SPAN&gt;))+&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 24 Jun 2022 21:03:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Working-Hours-excl-Weekends-amp-Holidays/m-p/2601390#M75190</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-24T21:03:19Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Working Hours excl Weekends &amp; Holidays</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Working-Hours-excl-Weekends-amp-Holidays/m-p/2605463#M75420</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Create a measure like this :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;WorkDays = 
VAR Calendar1 = CALENDAR(MAX('Table'[First Start Time]),MAX('Table'[Last Stop Time]))
VAR Calendar2 = ADDCOLUMNS(Calendar1,"WeekDay",WEEKDAY([Date],2))
VAR _hour1 = (COUNTX(FILTER(Calendar2,[WeekDay]&amp;lt;6),[Date])-5)*10
VAR _hour2 = if(hour(SELECTEDVALUE('Table'[Last Stop Time]))&amp;gt;=18,hour(SELECTEDVALUE('Table'[Last Stop Time])-SELECTEDVALUE('Table'[First Start Time]))-1,hour(SELECTEDVALUE('Table'[Last Stop Time])-SELECTEDVALUE('Table'[First Start Time])))
VAR _Minute=if(HOUR(SELECTEDVALUE('Table'[Last Stop Time]))&amp;gt;=18,60-MINUTE(SELECTEDVALUE('Table'[First Start Time])),MINUTE(SELECTEDVALUE('Table'[Last Stop Time])-SELECTEDVALUE('Table'[First Start Time])))
VAR _wholehour = _hour1+_hour2
VAR _diff = _wholehour&amp;amp; "h" &amp;amp;_Minute &amp;amp;"m"
RETURN _diff&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You will get a result like this :&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;I have attached my pbix file , you can refer to it .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Community Support Team _ Ailsa Tao&lt;BR /&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;STRONG&gt;&lt;I&gt;Accept it as the solution&lt;/I&gt;&lt;/STRONG&gt; to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jul 2022 09:13:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Working-Hours-excl-Weekends-amp-Holidays/m-p/2605463#M75420</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-07-05T09:13:28Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Working Hours excl Weekends &amp; Holidays</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Working-Hours-excl-Weekends-amp-Holidays/m-p/2605537#M75425</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;BR /&gt;I realized that there was a small mistake in the code where I used WEEKNUM function instead of using WEEKDAY. Here is the sample file updated&amp;nbsp;&lt;A href="https://we.tl/t-YYeFOgERsG" target="_blank"&gt;https://we.tl/t-YYeFOgERsG&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I doubled check the numbers manually and found accurate and the total is also accurate. It is also considering late start and early stop (these can be omitted&amp;nbsp;if not required)&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Working Hours = 
VAR Result =
    SUMX ( 
        WorkingHours,
        VAR CurrentStartDate = WorkingHours[First Start Time]
        VAR CurrentStopDate = WorkingHours[Last Stop Time]
        VAR StandardStartDate = DATE ( YEAR ( CurrentStartDate ), MONTH ( CurrentStartDate ), DAY ( CurrentStartDate ) ) + TIME ( 8, 0, 0 )
        VAR StandardEndDate = DATE ( YEAR ( CurrentStopDate ), MONTH ( CurrentStopDate ), DAY ( CurrentStopDate ) ) + TIME ( 18, 0, 0 )
        VAR LateStartMinutes = IF ( CurrentStartDate &amp;gt; StandardStartDate, DATEDIFF ( StandardStartDate, CurrentStartDate, MINUTE ), 0 )
        VAR EarlyStopMinutes = IF ( CurrentStopDate &amp;lt; StandardEndDate, DATEDIFF ( CurrentStopDate, StandardEndDate, MINUTE ), 0 )
        VAR AllDays = CALENDAR ( CurrentStartDate, CurrentStopDate )
        VAR AllWorkingDays = FILTER ( AllDays, NOT ( WEEKDAY ( [Date], 2 ) IN { 6, 7 } ) &amp;amp;&amp;amp; NOT ( [Date] IN VALUES ( Holidays[Date] ) ) )
        VAR WorkedMinutes = COUNTROWS ( AllWorkingDays ) * 600
        VAR NetWorkedMinutes = WorkedMinutes - LateStartMinutes - EarlyStopMinutes
        RETURN
            NetWorkedMinutes
    )
RETURN
    FORMAT ( QUOTIENT ( Result, 60 ), "#,#" ) &amp;amp; " Hours &amp;amp; " &amp;amp; FORMAT ( MOD ( Result, 60 ), "00" ) &amp;amp; " Minutes"&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 28 Jun 2022 03:58:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Working-Hours-excl-Weekends-amp-Holidays/m-p/2605537#M75425</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-06-28T03:58:00Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Working Hours excl Weekends &amp; Holidays</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Working-Hours-excl-Weekends-amp-Holidays/m-p/2605545#M75426</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;BR /&gt;Working hours are 10 not 8. I believe&amp;nbsp;the the off days need to be considered automatically not manually. also the grand total in this case is of a great importance and cannot be just ignored.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jun 2022 04:06:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Working-Hours-excl-Weekends-amp-Holidays/m-p/2605545#M75426</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-06-28T04:06:52Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Working Hours excl Weekends &amp; Holidays</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Working-Hours-excl-Weekends-amp-Holidays/m-p/2605602#M75430</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What are your working hours? 8 hours or 10 hours ? Also, is the holiday you're talking about your regular holiday or just for you ? Looking forward to your reply .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Community Support Team _ Ailsa Tao&lt;BR /&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;STRONG&gt;&lt;I&gt;Accept it as the solution&lt;/I&gt;&lt;/STRONG&gt; to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jun 2022 05:19:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Working-Hours-excl-Weekends-amp-Holidays/m-p/2605602#M75430</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-28T05:19:03Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Working Hours excl Weekends &amp; Holidays</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Working-Hours-excl-Weekends-amp-Holidays/m-p/2608550#M75579</link>
      <description>&lt;P&gt;Hi Ailsa,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Our working hours is 8 hrs but I am considering 2 hrs as overtime. So need to get result with 10 hrs.&lt;/P&gt;&lt;P&gt;And the holidays are not the regular holidays, they are just for that particular occassion.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jun 2022 07:17:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Working-Hours-excl-Weekends-amp-Holidays/m-p/2608550#M75579</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-29T07:17:32Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Working Hours excl Weekends &amp; Holidays</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Working-Hours-excl-Weekends-amp-Holidays/m-p/2608571#M75582</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ok, then it is calculated according to 10 hours of working time, I will update my formula, you can refer to the following .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Community Support Team _ Ailsa Tao&lt;BR /&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;STRONG&gt;&lt;I&gt;Accept it as the solution&lt;/I&gt;&lt;/STRONG&gt; to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jun 2022 07:27:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Working-Hours-excl-Weekends-amp-Holidays/m-p/2608571#M75582</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-06-29T07:27:45Z</dc:date>
    </item>
  </channel>
</rss>

