<?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: NEtwork Days M language in Power Query</title>
    <link>https://community.fabric.microsoft.com/t5/Power-Query/NEtwork-Days-M-language/m-p/868631#M29331</link>
    <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;seems to be fine&lt;/P&gt;&lt;P&gt;just add the column of this table as third parameter like TableName[ColumnName]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jimmy&lt;/P&gt;</description>
    <pubDate>Sun, 08 Dec 2019 10:47:09 GMT</pubDate>
    <dc:creator>Jimmy801</dc:creator>
    <dc:date>2019-12-08T10:47:09Z</dc:date>
    <item>
      <title>NEtwork Days M language</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/NEtwork-Days-M-language/m-p/868277#M29289</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mceItemHidden"&gt;I have to create&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="hiddenSpellError"&gt;KPI's&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;based&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;on&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="hiddenSpellError"&gt;sla's&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;of orders management. I want to calculate those SLA's in working days at power Query (Not Dax).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mceItemHidden"&gt;I read many&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;purposes&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to solutions , but&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="hiddenSpellError"&gt;didn't&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;succeed in adopting it for my File (because a very weak&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;knowledge&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;of M language).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mceItemHidden"&gt;In a link below is my&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="hiddenSpellError"&gt;pbix&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;file with 2 periods&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;for example,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;may be&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;someone&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;can explain me step by step how can&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="hiddenGrammarError"&gt;i&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;calculate in just working days without weekends and holidays&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="hiddenSpellError"&gt;EndSaleTime-StartSale&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;time and / or&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mceItemHidden"&gt;&lt;SPAN class="hiddenSpellError"&gt;EndSupplyTime-StartSupply&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Time or just put it on my&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="hiddenSpellError"&gt;pbix&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;file .&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://drive.google.com/drive/folders/1xQRM3C9q5uoTs47lYv7FoM5Y3vqZQy2l?usp=sharing" target="_self"&gt;https://drive.google.com/drive/folders/1xQRM3C9q5uoTs47lYv7FoM5Y3vqZQy2l?usp=sharing&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mceItemHidden"&gt;please don't send me to links of similar questions and solutions because&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="hiddenGrammarError"&gt;i&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;read them .&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Rita&lt;/P&gt;</description>
      <pubDate>Sat, 07 Dec 2019 01:53:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/NEtwork-Days-M-language/m-p/868277#M29289</guid>
      <dc:creator>Ritaf</dc:creator>
      <dc:date>2019-12-07T01:53:03Z</dc:date>
    </item>
    <item>
      <title>Re: NEtwork Days M language</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/NEtwork-Days-M-language/m-p/868442#M29300</link>
      <description>&lt;P&gt;Hello &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="115491" data-lia-user-login="Ritaf" class="lia-mention lia-mention-user"&gt;Ritaf&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I understand what exactly you need.. what are sla? What do you want to calculate exactly?&lt;/P&gt;&lt;P&gt;If you could provide some data example with the desired output with a detailed description of it or the final goal would help and be appreciated.&lt;/P&gt;&lt;P&gt;by the way is a Power-BI-file saved as .xlsx&lt;/P&gt;&lt;P&gt;Have a nice time&lt;/P&gt;&lt;P&gt;Jimmy&lt;/P&gt;</description>
      <pubDate>Sat, 07 Dec 2019 15:46:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/NEtwork-Days-M-language/m-p/868442#M29300</guid>
      <dc:creator>Jimmy801</dc:creator>
      <dc:date>2019-12-07T15:46:47Z</dc:date>
    </item>
    <item>
      <title>Re: NEtwork Days M language</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/NEtwork-Days-M-language/m-p/868463#M29309</link>
      <description>&lt;P&gt;Hi Jimmy,&lt;/P&gt;&lt;P&gt;I just want to calculate a difference bertween 2 dates without weekends snd/ or holidays , for this cse study i not matter which, i just need to understend the code. And thank you for your paying attention i put a pbix file.&lt;/P&gt;</description>
      <pubDate>Sat, 07 Dec 2019 16:30:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/NEtwork-Days-M-language/m-p/868463#M29309</guid>
      <dc:creator>Ritaf</dc:creator>
      <dc:date>2019-12-07T16:30:24Z</dc:date>
    </item>
    <item>
      <title>Re: NEtwork Days M language</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/NEtwork-Days-M-language/m-p/868477#M29311</link>
      <description>Hey&lt;BR /&gt;Difference in days i suppose&lt;BR /&gt;Jimmy</description>
      <pubDate>Sat, 07 Dec 2019 17:27:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/NEtwork-Days-M-language/m-p/868477#M29311</guid>
      <dc:creator>Jimmy801</dc:creator>
      <dc:date>2019-12-07T17:27:06Z</dc:date>
    </item>
    <item>
      <title>Re: NEtwork Days M language</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/NEtwork-Days-M-language/m-p/868480#M29313</link>
      <description>&lt;P&gt;Hi ,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Days ( hours is good to know too)&lt;/P&gt;</description>
      <pubDate>Sat, 07 Dec 2019 17:29:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/NEtwork-Days-M-language/m-p/868480#M29313</guid>
      <dc:creator>Ritaf</dc:creator>
      <dc:date>2019-12-07T17:29:03Z</dc:date>
    </item>
    <item>
      <title>Re: NEtwork Days M language</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/NEtwork-Days-M-language/m-p/868484#M29315</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this function gives back the diffence in hours, excluding the weekends.&lt;/P&gt;&lt;P&gt;You have to pass starttime and endtime. You can pass optionally a list with holidays to exclude them to&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;(StartTime as datetime, EndTime as datetime, ListHoliday as nullable list) as number =&amp;gt;
let
    //StartTime = #datetime(2019,12,3,8,00,00),
    //EndTime = #datetime(2019, 12, 8, 8, 0, 0),
    //ListHoliday = {"03.12.19", "04.12.19"},
    ListHolidayCheck = if ListHoliday = null then {} else ListHoliday,
    ListHolidayInternal = List.Transform(ListHolidayCheck, each Date.From(_)),
    DurationInHours = (Number.From(EndTime)-Number.From(StartTime))*24,
    DateTimesFromStartEnd = List.DateTimes(StartTime, DurationInHours, #duration(0,1,0,0)),
    FilterHolidays = List.Transform(DateTimesFromStartEnd, each if List.Contains(ListHolidayInternal, Date.From(_))= true then null else _),
    TableWithDateTime = #table({"DateTime"}, List.Zip({FilterHolidays})),
    #"Added Custom" = Table.AddColumn(TableWithDateTime, "Hours", each 1),
    #"Inserted Day of Week" = Table.AddColumn(#"Added Custom", "Day of Week", each Date.DayOfWeek([DateTime], Day.Monday), Int64.Type),
    #"Filtered Rows" = Table.SelectRows(#"Inserted Day of Week", each ([Day of Week] &amp;lt; 5)),
    HoursSum = List.Sum(#"Filtered Rows"[Hours])
in
    HoursSum&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt; or &lt;STRONG&gt;solves &lt;/STRONG&gt;your problem, please mark it as solution.&lt;BR /&gt;Kudos are nice to - thanks&lt;BR /&gt;Have fun&lt;BR /&gt;&lt;BR /&gt;Jimmy&lt;/P&gt;</description>
      <pubDate>Sat, 07 Dec 2019 17:36:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/NEtwork-Days-M-language/m-p/868484#M29315</guid>
      <dc:creator>Jimmy801</dc:creator>
      <dc:date>2019-12-07T17:36:45Z</dc:date>
    </item>
    <item>
      <title>Re: NEtwork Days M language</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/NEtwork-Days-M-language/m-p/868485#M29316</link>
      <description>&lt;P&gt;Hi, this is one of solutions i tried an i get an error:&lt;/P&gt;&lt;P&gt;Expression.Error: We cannot convert the value null to type DateTime.&lt;BR /&gt;Details:&lt;BR /&gt;Value=&lt;BR /&gt;Type=[Type]&lt;/P&gt;&lt;P&gt;How can i solve that?&lt;/P&gt;</description>
      <pubDate>Sat, 07 Dec 2019 17:49:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/NEtwork-Days-M-language/m-p/868485#M29316</guid>
      <dc:creator>Ritaf</dc:creator>
      <dc:date>2019-12-07T17:49:51Z</dc:date>
    </item>
    <item>
      <title>Re: NEtwork Days M language</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/NEtwork-Days-M-language/m-p/868487#M29317</link>
      <description>Hello&lt;BR /&gt;Maybe you are invoking the function with null in the first or second parameter or try to pass null as third parameter&lt;BR /&gt;Jimmy</description>
      <pubDate>Sat, 07 Dec 2019 17:52:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/NEtwork-Days-M-language/m-p/868487#M29317</guid>
      <dc:creator>Jimmy801</dc:creator>
      <dc:date>2019-12-07T17:52:52Z</dc:date>
    </item>
    <item>
      <title>Re: NEtwork Days M language</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/NEtwork-Days-M-language/m-p/868489#M29319</link>
      <description>&lt;P&gt;I am just choosing my startDate, End DAte and holidys column. How can i change this?&lt;/P&gt;</description>
      <pubDate>Sat, 07 Dec 2019 17:59:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/NEtwork-Days-M-language/m-p/868489#M29319</guid>
      <dc:creator>Ritaf</dc:creator>
      <dc:date>2019-12-07T17:59:55Z</dc:date>
    </item>
    <item>
      <title>Re: NEtwork Days M language</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/NEtwork-Days-M-language/m-p/868500#M29320</link>
      <description>Hello&lt;BR /&gt;It has to be datetimes and last parameter null</description>
      <pubDate>Sat, 07 Dec 2019 18:21:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/NEtwork-Days-M-language/m-p/868500#M29320</guid>
      <dc:creator>Jimmy801</dc:creator>
      <dc:date>2019-12-07T18:21:47Z</dc:date>
    </item>
    <item>
      <title>Re: NEtwork Days M language</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/NEtwork-Days-M-language/m-p/868503#M29321</link>
      <description>&lt;P&gt;Hi again,&lt;/P&gt;&lt;P&gt;i played with this and saw that i have sum null values in startDate, i replace it with 01/01/01 01:00:00 it seems worked but now i think i have some problem with holidays, i see that this calculion takes a lot of time and see strange message (attached) and this gigabytes is continue to growing up&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 07 Dec 2019 18:23:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/NEtwork-Days-M-language/m-p/868503#M29321</guid>
      <dc:creator>Ritaf</dc:creator>
      <dc:date>2019-12-07T18:23:23Z</dc:date>
    </item>
    <item>
      <title>Re: NEtwork Days M language</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/NEtwork-Days-M-language/m-p/868506#M29322</link>
      <description>Please share the file&lt;BR /&gt;For holidays you have to pass a list of days</description>
      <pubDate>Sat, 07 Dec 2019 18:29:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/NEtwork-Days-M-language/m-p/868506#M29322</guid>
      <dc:creator>Jimmy801</dc:creator>
      <dc:date>2019-12-07T18:29:45Z</dc:date>
    </item>
    <item>
      <title>Re: NEtwork Days M language</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/NEtwork-Days-M-language/m-p/868606#M29326</link>
      <description>&lt;P&gt;The function below takes a different approach to the issue. It should be fast and small because it does not generate dates.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(DateStart as date, DateEnd as date, optional Holidays as list) =&amp;gt;&lt;BR /&gt;let&lt;BR /&gt;Switch = DateStart &amp;gt; DateEnd,&lt;BR /&gt;StartDate = if Switch then DateEnd else DateStart,&lt;BR /&gt;EndDate = if Switch then DateStart else DateEnd,&lt;BR /&gt;WeekDaysInRange=&lt;BR /&gt;(Duration.TotalDays((EndDate-(StartDate+Duration.From(Date.DayOfWeek(EndDate)-Date.DayOfWeek(StartDate)))))/7*5)&lt;BR /&gt;+Date.DayOfWeek(EndDate)-Date.DayOfWeek(StartDate)+1&lt;BR /&gt;+(if Date.DayOfWeek(StartDate)=0 then -1 else 0)+(if Date.DayOfWeek(EndDate)=6 then -1 else 0),&lt;BR /&gt;HolidaysInRange = if Holidays = null then {} else&lt;BR /&gt;List.Select(Holidays, each StartDate &amp;lt;= _ and _ &amp;lt;= EndDate and Date.DayOfWeek(_, Day.Monday) &amp;lt;5 ),&lt;BR /&gt;Result = (if Switch then -1 else 1) * ((WeekDaysInRange) - List.Count(HolidaysInRange))&lt;BR /&gt;in&lt;BR /&gt;Result&lt;/P&gt;</description>
      <pubDate>Sun, 08 Dec 2019 08:54:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/NEtwork-Days-M-language/m-p/868606#M29326</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-12-08T08:54:03Z</dc:date>
    </item>
    <item>
      <title>Re: NEtwork Days M language</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/NEtwork-Days-M-language/m-p/868613#M29327</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thank you very much for your responding.&lt;/P&gt;&lt;P&gt;Unfortunately it isn't working, ,may be because of some blank cells in my start day columns (I cant remove this rows because of orher measures from this data)&lt;span class="lia-unicode-emoji" title=":loudly_crying_face:"&gt;😭&lt;/span&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 08 Dec 2019 10:11:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/NEtwork-Days-M-language/m-p/868613#M29327</guid>
      <dc:creator>Ritaf</dc:creator>
      <dc:date>2019-12-08T10:11:43Z</dc:date>
    </item>
    <item>
      <title>Re: NEtwork Days M language</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/NEtwork-Days-M-language/m-p/868623#M29328</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this is for sure the better approach as i hasn't to create any list that will slow down for sure.&lt;/P&gt;&lt;P&gt;I've gave it a test and it seems that something is not quite ok. Check out this table&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Have a nice day&lt;/P&gt;&lt;P&gt;Jimmy&lt;/P&gt;</description>
      <pubDate>Sun, 08 Dec 2019 10:28:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/NEtwork-Days-M-language/m-p/868623#M29328</guid>
      <dc:creator>Jimmy801</dc:creator>
      <dc:date>2019-12-08T10:28:54Z</dc:date>
    </item>
    <item>
      <title>Re: NEtwork Days M language</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/NEtwork-Days-M-language/m-p/868624#M29329</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;invoke the function like this&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;try fnNetWorkDays(Date.From([Start]),Date.From([End])) otherwise null&lt;/LI-CODE&gt;&lt;P&gt;but be carefull as the code proposed by Anonymous&lt;/a&gt; seems to have some problems&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt; or &lt;STRONG&gt;solves &lt;/STRONG&gt;your problem, please mark it as solution.&lt;BR /&gt;Kudos are nice to - thanks&lt;BR /&gt;Have fun&lt;BR /&gt;&lt;BR /&gt;Jimmy&lt;/P&gt;</description>
      <pubDate>Sun, 08 Dec 2019 10:34:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/NEtwork-Days-M-language/m-p/868624#M29329</guid>
      <dc:creator>Jimmy801</dc:creator>
      <dc:date>2019-12-08T10:34:54Z</dc:date>
    </item>
    <item>
      <title>Re: NEtwork Days M language</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/NEtwork-Days-M-language/m-p/868629#M29330</link>
      <description>&lt;P&gt;May i need to edit the holidays list some way? Now is look like this&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 08 Dec 2019 10:38:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/NEtwork-Days-M-language/m-p/868629#M29330</guid>
      <dc:creator>Ritaf</dc:creator>
      <dc:date>2019-12-08T10:38:51Z</dc:date>
    </item>
    <item>
      <title>Re: NEtwork Days M language</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/NEtwork-Days-M-language/m-p/868631#M29331</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;seems to be fine&lt;/P&gt;&lt;P&gt;just add the column of this table as third parameter like TableName[ColumnName]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jimmy&lt;/P&gt;</description>
      <pubDate>Sun, 08 Dec 2019 10:47:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/NEtwork-Days-M-language/m-p/868631#M29331</guid>
      <dc:creator>Jimmy801</dc:creator>
      <dc:date>2019-12-08T10:47:09Z</dc:date>
    </item>
    <item>
      <title>Re: NEtwork Days M language</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/NEtwork-Days-M-language/m-p/868643#M29333</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to speed up my version. so if you have no performance issue with this solution, I would go for it.&lt;/P&gt;&lt;P&gt;This solution is slower af the other proposed Anonymous&lt;/a&gt; . But if we come to include holiday it's faster&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;// fnNetWorkDays
(DateStart as date, DateEnd as date, optional Holidays as list) =&amp;gt;
let
    Switch = DateStart &amp;gt; DateEnd,
    StartDate = if Switch then DateEnd else DateStart,
    EndDate = if Switch then DateStart else DateEnd,
    WeekDaysInRange=
        (
            Duration.TotalDays
            (
                (   
                    EndDate-
                    (
                        StartDate
                        +Duration.From
                        (
                            Date.DayOfWeek
                            (
                                EndDate
                            )
                            -Date.DayOfWeek
                            (
                                StartDate
                            )
                        )
                    )
                )
            )
            /7*5
        )
        +Date.DayOfWeek
        (
            EndDate
        )
        -Date.DayOfWeek
        (
            StartDate
        )
        +1
        +
        (
            if Date.DayOfWeek
                (
                    StartDate
                )=0 
                then
                -1
                else
                0
        )
        +
        (
            if Date.DayOfWeek
                (
                    EndDate
                )=6
                then 
                -1 
                else
                0
        ),
    HolidaysInRange = if Holidays = null then {} else
    List.Select(Holidays, each StartDate &amp;lt;= _ and _ &amp;lt;= EndDate and Date.DayOfWeek(_, Day.Monday) &amp;lt;5 ),
    Result = (if Switch then -1 else 1) * ((WeekDaysInRange) - List.Count(HolidaysInRange))
in
    Result

// fnNetWorkDays2
(DateStart as date, DateEnd as date, optional Holidays as list) =&amp;gt;
let
    Switch = DateStart &amp;gt; DateEnd,
    StartDate = if Switch then DateEnd else DateStart,
    EndDate = if Switch then DateStart else DateEnd,
    HolidayIntern = if Holidays = null then List.Buffer({}) else List.Buffer(Holidays),
    CreateListDates =List.Buffer( List.Dates
    (
        StartDate,
        Duration.TotalDays
        (
            EndDate - StartDate
        )
        +1,
        #duration(1,0,0,0)
    )),

    ExcludeWeekend = List.Select
    (
        CreateListDates,
        each 
        Date.DayOfWeek
        (
            _,
            Day.Monday
        )
        &amp;lt;5
    ),

    ExcludeHoliday = 
    if Holidays = null then ExcludeWeekend else List.Difference
    (
        ExcludeWeekend,
        HolidayIntern
    ),
    Result = List.Count
    (
        ExcludeHoliday
    ),

    FinalResult = try (if Switch then -1 else 1) * (Result) otherwise null
    
in
    FinalResult&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt; or &lt;STRONG&gt;solves &lt;/STRONG&gt;your problem, please mark it as solution.&lt;BR /&gt;Kudos are nice to - thanks&lt;BR /&gt;Have fun&lt;BR /&gt;&lt;BR /&gt;Jimmy&lt;/P&gt;</description>
      <pubDate>Sun, 08 Dec 2019 11:41:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/NEtwork-Days-M-language/m-p/868643#M29333</guid>
      <dc:creator>Jimmy801</dc:creator>
      <dc:date>2019-12-08T11:41:20Z</dc:date>
    </item>
    <item>
      <title>Re: NEtwork Days M language</title>
      <link>https://community.fabric.microsoft.com/t5/Power-Query/NEtwork-Days-M-language/m-p/868658#M29334</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;i tried to use a code an now is a syntax error&lt;img /&gt;&lt;span class="lia-unicode-emoji" title=":loudly_crying_face:"&gt;😭&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 08 Dec 2019 12:34:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Power-Query/NEtwork-Days-M-language/m-p/868658#M29334</guid>
      <dc:creator>Ritaf</dc:creator>
      <dc:date>2019-12-08T12:34:16Z</dc:date>
    </item>
  </channel>
</rss>

