<?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: Adding SLA +1 day to a Delivery Date excluding Weekends &amp;amp; Public Holidays in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-SLA-1-day-to-a-Delivery-Date-excluding-Weekends-amp/m-p/2989655#M100529</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I added a new table into the file by using the below formula.&lt;/P&gt;
&lt;P&gt;It is for creating a new table.&lt;/P&gt;
&lt;P&gt;Please check if it suits your requirement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Expected result Table =
VAR _calendar =
    ADDCOLUMNS (
        CALENDAR ( DATE ( 2022, 1, 1 ), DATE ( 2023, 12, 31 ) ),
        "@Dayname", FORMAT ( [Date], "dddd" )
    )
VAR _holidaycalendar =
    SUMMARIZE (
        FILTER (
            ADDCOLUMNS ( _calendar, "@holiday", [Date] IN DISTINCT ( Holiday[Holiday] ) ),
            [@holiday] = TRUE ()
        ),
        [Date]
    )
VAR _actualstartdate =
    ADDCOLUMNS (
        Data,
        "@actualstartdate",
            MINX (
                FILTER (
                    _calendar,
                    [Date] &amp;gt;= EARLIER ( Data[Delivery date] )
                        &amp;amp;&amp;amp; NOT ( [Date] IN _holidaycalendar )
                        &amp;amp;&amp;amp; [@Dayname] &amp;lt;&amp;gt; "Saturday"
                        &amp;amp;&amp;amp; [@Dayname] &amp;lt;&amp;gt; "Sunday"
                ),
                [Date]
            )
    )
VAR _networkdays =
    FILTER (
        ADDCOLUMNS (
            GENERATE (
                _actualstartdate,
                CALENDAR ( [@actualstartdate], [@actualstartdate] + 30 )
            ),
            "@networkdays", NETWORKDAYS ( [@actualstartdate], [Date], 1, _holidaycalendar )
        ),
        [@networkdays] = 3
    )
RETURN
    GROUPBY (
        _networkdays,
        Data[Delivery date],
        Data[Day Name],
        "@expectedresultdate", MINX ( CURRENTGROUP (), [Date] )
    )
&lt;/LI-CODE&gt;</description>
    <pubDate>Tue, 27 Dec 2022 07:24:24 GMT</pubDate>
    <dc:creator>Jihwan_Kim</dc:creator>
    <dc:date>2022-12-27T07:24:24Z</dc:date>
    <item>
      <title>Adding SLA +1 day to a Delivery Date excluding Weekends &amp; Public Holidays</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-SLA-1-day-to-a-Delivery-Date-excluding-Weekends-amp/m-p/2989444#M100515</link>
      <description>&lt;P&gt;Hi Sir/Mdm,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need some help with the Power BI query of adding a SLA of a day to a date while excluding Weekends and Public holidays&lt;/P&gt;&lt;P&gt;Have been trying to find similar answers here but has been futile.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example: 30 Dec 2022 (friday) + 1 day SLA + excluding New Year Holiday; to return 4 Jan (since that 2 Jan is the New Year Observed Holiday + 1 day SLA)&lt;BR /&gt;&lt;BR /&gt;In excel i could easily use workday to exclude the weekends and holidays + a day of SLA&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any advice and help with the code is truly appreciated. Thank you&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Dec 2022 03:24:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-SLA-1-day-to-a-Delivery-Date-excluding-Weekends-amp/m-p/2989444#M100515</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-12-27T03:24:37Z</dc:date>
    </item>
    <item>
      <title>Re: Adding SLA +1 day to a Delivery Date excluding Weekends &amp; Public Holidays</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-SLA-1-day-to-a-Delivery-Date-excluding-Weekends-amp/m-p/2989476#M100516</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt; , You need to create column with flag of weekend and holiday, and then follow an approch like &lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Community-Blog/Travelling-Across-Workdays-Decoding-Date-and-Calendar-4-5-Power/ba-p/1187766" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/Travelling-Across-Workdays-Decoding-Date-and-Calendar-4-5-Power/ba-p/1187766&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Column code is given in the comments&lt;/P&gt;</description>
      <pubDate>Tue, 27 Dec 2022 04:02:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-SLA-1-day-to-a-Delivery-Date-excluding-Weekends-amp/m-p/2989476#M100516</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2022-12-27T04:02:13Z</dc:date>
    </item>
    <item>
      <title>Re: Adding SLA +1 day to a Delivery Date excluding Weekends &amp; Public Holidays</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-SLA-1-day-to-a-Delivery-Date-excluding-Weekends-amp/m-p/2989508#M100517</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I am not sure if I understood your question correctly, but please check the below formula and the attached pbix file.&lt;/P&gt;
&lt;P&gt;It is for creating a new column.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Expected result CC =
VAR _calendar =
    ADDCOLUMNS (
        CALENDAR ( DATE ( 2022, 1, 1 ), DATE ( 2023, 12, 31 ) ),
        "@Dayname", FORMAT ( [Date], "dddd" )
    )
VAR _holidaycalendar =
    SUMMARIZE (
        FILTER (
            ADDCOLUMNS ( _calendar, "@holiday", [Date] IN DISTINCT ( Holiday[Holiday] ) ),
            [@holiday] = TRUE ()
        ),
        [Date]
    )
VAR _actualstartdate =
    ADDCOLUMNS (
        Data,
        "@actualstartdate",
            MINX (
                FILTER (
                    _calendar,
                    [Date] &amp;gt;= EARLIER ( Data[Delivery date] )
                        &amp;amp;&amp;amp; NOT ( [Date] IN _holidaycalendar )
                        &amp;amp;&amp;amp; [@Dayname] &amp;lt;&amp;gt; "Saturday"
                        &amp;amp;&amp;amp; [@Dayname] &amp;lt;&amp;gt; "Sunday"
                ),
                [Date]
            )
    )
VAR _networkdays =
    FILTER (
        ADDCOLUMNS (
            GENERATE (
                _actualstartdate,
                CALENDAR ( [@actualstartdate], [@actualstartdate] + 30 )
            ),
            "@networkdays", NETWORKDAYS ( [@actualstartdate], [Date], 1, _holidaycalendar )
        ),
        [@networkdays] = 3
    )
RETURN
    MINX (
        FILTER ( _networkdays, Data[Delivery date] = EARLIER ( Data[Delivery date] ) ),
        [Date]
    )&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 27 Dec 2022 04:41:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-SLA-1-day-to-a-Delivery-Date-excluding-Weekends-amp/m-p/2989508#M100517</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2022-12-27T04:41:29Z</dc:date>
    </item>
    <item>
      <title>Re: Adding SLA +1 day to a Delivery Date excluding Weekends &amp; Public Holidays</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-SLA-1-day-to-a-Delivery-Date-excluding-Weekends-amp/m-p/2989548#M100520</link>
      <description>&lt;P&gt;Thank you so much Mr Jihwan, this works!. appreciate so much for the advice!&lt;/P&gt;</description>
      <pubDate>Tue, 27 Dec 2022 05:55:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-SLA-1-day-to-a-Delivery-Date-excluding-Weekends-amp/m-p/2989548#M100520</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-12-27T05:55:51Z</dc:date>
    </item>
    <item>
      <title>Re: Adding SLA +1 day to a Delivery Date excluding Weekends &amp; Public Holidays</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-SLA-1-day-to-a-Delivery-Date-excluding-Weekends-amp/m-p/2989563#M100522</link>
      <description>&lt;P&gt;hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try to&lt;/P&gt;&lt;P&gt;1) load the holidays as a table.&lt;/P&gt;&lt;P&gt;2) create a DateTable like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;DateTable = 
ADDCOLUMNS(
    CALENDAR(DATE(2022,12,1), DATE(2023,2,1)),
    "IsHolidayWeekend",    
    IF(
        [Date] IN ALL(Holiday[Date])
            || WEEKDAY([Date],2) IN {6,7},
        "Yes", "No"
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;3) add a column in your delivery table like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;ExpectedDeliveryDate2 = 
VAR _date = [DeliveyDate]
RETURN 
MINX(
    FILTER(
        DateTable,
        DateTable[IsHolidayWeekend] = "No"
            &amp;amp;&amp;amp;DateTable[Date]&amp;gt;_date
    ),
    DateTable[Date]
)+1&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried and it worked like this:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Dec 2022 06:08:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-SLA-1-day-to-a-Delivery-Date-excluding-Weekends-amp/m-p/2989563#M100522</guid>
      <dc:creator>FreemanZ</dc:creator>
      <dc:date>2022-12-27T06:08:18Z</dc:date>
    </item>
    <item>
      <title>Re: Adding SLA +1 day to a Delivery Date excluding Weekends &amp; Public Holidays</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-SLA-1-day-to-a-Delivery-Date-excluding-Weekends-amp/m-p/2989602#M100524</link>
      <description>&lt;P&gt;Hi Mr Jihwan,&lt;BR /&gt;Quick question, if i have wish to have a separate table for the SLA, how should i go about doing that?&amp;nbsp;&lt;BR /&gt;apology for the question if this is a straight forward ans.. i'm still new to BI.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Dec 2022 06:42:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-SLA-1-day-to-a-Delivery-Date-excluding-Weekends-amp/m-p/2989602#M100524</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-12-27T06:42:42Z</dc:date>
    </item>
    <item>
      <title>Re: Adding SLA +1 day to a Delivery Date excluding Weekends &amp; Public Holidays</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-SLA-1-day-to-a-Delivery-Date-excluding-Weekends-amp/m-p/2989655#M100529</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I added a new table into the file by using the below formula.&lt;/P&gt;
&lt;P&gt;It is for creating a new table.&lt;/P&gt;
&lt;P&gt;Please check if it suits your requirement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Expected result Table =
VAR _calendar =
    ADDCOLUMNS (
        CALENDAR ( DATE ( 2022, 1, 1 ), DATE ( 2023, 12, 31 ) ),
        "@Dayname", FORMAT ( [Date], "dddd" )
    )
VAR _holidaycalendar =
    SUMMARIZE (
        FILTER (
            ADDCOLUMNS ( _calendar, "@holiday", [Date] IN DISTINCT ( Holiday[Holiday] ) ),
            [@holiday] = TRUE ()
        ),
        [Date]
    )
VAR _actualstartdate =
    ADDCOLUMNS (
        Data,
        "@actualstartdate",
            MINX (
                FILTER (
                    _calendar,
                    [Date] &amp;gt;= EARLIER ( Data[Delivery date] )
                        &amp;amp;&amp;amp; NOT ( [Date] IN _holidaycalendar )
                        &amp;amp;&amp;amp; [@Dayname] &amp;lt;&amp;gt; "Saturday"
                        &amp;amp;&amp;amp; [@Dayname] &amp;lt;&amp;gt; "Sunday"
                ),
                [Date]
            )
    )
VAR _networkdays =
    FILTER (
        ADDCOLUMNS (
            GENERATE (
                _actualstartdate,
                CALENDAR ( [@actualstartdate], [@actualstartdate] + 30 )
            ),
            "@networkdays", NETWORKDAYS ( [@actualstartdate], [Date], 1, _holidaycalendar )
        ),
        [@networkdays] = 3
    )
RETURN
    GROUPBY (
        _networkdays,
        Data[Delivery date],
        Data[Day Name],
        "@expectedresultdate", MINX ( CURRENTGROUP (), [Date] )
    )
&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 27 Dec 2022 07:24:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-SLA-1-day-to-a-Delivery-Date-excluding-Weekends-amp/m-p/2989655#M100529</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2022-12-27T07:24:24Z</dc:date>
    </item>
  </channel>
</rss>

