<?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: How To Calculate Difference Between Dates in Same Column excluding weekends in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-To-Calculate-Difference-Between-Dates-in-Same-Column/m-p/2512684#M69737</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="342771" data-lia-user-login="Lior0707" class="lia-mention lia-mention-user"&gt;Lior0707&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;According to your description,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="313" data-lia-user-login="Greg_Deckler" class="lia-mention lia-mention-user"&gt;Greg_Deckler&lt;/a&gt;&amp;nbsp; gave a good solution on dates in two columns.&lt;/P&gt;
&lt;P&gt;You mentioned that your dates are in same column. In this case, there are different solutions based on different data.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;1.&lt;/STRONG&gt; If the column only have two date rows.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;First add an index column in Power Query, then create a measure.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Date diff =
VAR Calendar1 =
    CALENDAR (
        MAXX ( FILTER ( ALL ( 'Table' ), 'Table'[Index] = 1 ), 'Table'[Date] ),
        MAXX ( FILTER ( ALL ( 'Table' ), 'Table'[Index] = 2 ), 'Table'[Date] )
    )
VAR Calendar2 =
    ADDCOLUMNS ( Calendar1, "WeekDay", WEEKDAY ( [Date], 2 ) )
RETURN
    COUNTX ( FILTER ( Calendar2, [WeekDay] &amp;lt; 6 ), [Date] )
&lt;/LI-CODE&gt;
&lt;P&gt;Get the result.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;2.&lt;/STRONG&gt; If there are multiple rows of dates in the column, and you want to compare the difference between every two rows of dates.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;First add an index column in Power Query, then create a measure.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Date diff2 =
VAR Calendar1 =
    CALENDAR (
        MAX ( 'Table'[Date] ),
        IF (
            MAX ( 'Table'[Index] ) &amp;lt;&amp;gt; MAXX ( ALL ( 'Table' ), 'Table'[Index] ),
            MAXX (
                FILTER ( ALL ( 'Table' ), 'Table'[Index] = MAX ( 'Table'[Index] ) + 1 ),
                'Table'[Date]
            ),
            MAX ( 'Table'[Date] )
        )
    )
VAR Calendar2 =
    ADDCOLUMNS ( Calendar1, "WeekDay", WEEKDAY ( [Date], 2 ) )
RETURN
    COUNTX ( FILTER ( Calendar2, [WeekDay] &amp;lt; 6 ), [Date] )
&lt;/LI-CODE&gt;
&lt;P&gt;Get the result.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;I attach my sample below for reference.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Community Support Team _ kalyj&lt;/P&gt;
&lt;P&gt;If this post&lt;SPAN&gt;&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;helps,&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;then please consider&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;to help the other members find it more quickly.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 13 May 2022 08:11:20 GMT</pubDate>
    <dc:creator>v-yanjiang-msft</dc:creator>
    <dc:date>2022-05-13T08:11:20Z</dc:date>
    <item>
      <title>How To Calculate Difference Between Dates in Same Column excluding weekends</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-To-Calculate-Difference-Between-Dates-in-Same-Column/m-p/2503159#M69249</link>
      <description>&lt;P&gt;Hi All ,&lt;/P&gt;&lt;H1&gt;How To Calculate Difference Between Dates in Same Column excluding weekends.&lt;/H1&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank You&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Lior&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2022 22:14:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-To-Calculate-Difference-Between-Dates-in-Same-Column/m-p/2503159#M69249</guid>
      <dc:creator>Lior0707</dc:creator>
      <dc:date>2022-05-09T22:14:31Z</dc:date>
    </item>
    <item>
      <title>Re: How To Calculate Difference Between Dates in Same Column excluding weekends</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-To-Calculate-Difference-Between-Dates-in-Same-Column/m-p/2503251#M69253</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="342771" data-lia-user-login="Lior0707" class="lia-mention lia-mention-user"&gt;Lior0707&lt;/a&gt;&amp;nbsp;&lt;A href="https://community.powerbi.com/t5/Quick-Measures-Gallery/Net-Work-Days/m-p/367362#M109" target="_blank"&gt;Net Work Days - Microsoft Power BI Community&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 May 2022 00:38:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-To-Calculate-Difference-Between-Dates-in-Same-Column/m-p/2503251#M69253</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2022-05-10T00:38:03Z</dc:date>
    </item>
    <item>
      <title>Re: How To Calculate Difference Between Dates in Same Column excluding weekends</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-To-Calculate-Difference-Between-Dates-in-Same-Column/m-p/2512684#M69737</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="342771" data-lia-user-login="Lior0707" class="lia-mention lia-mention-user"&gt;Lior0707&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;According to your description,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="313" data-lia-user-login="Greg_Deckler" class="lia-mention lia-mention-user"&gt;Greg_Deckler&lt;/a&gt;&amp;nbsp; gave a good solution on dates in two columns.&lt;/P&gt;
&lt;P&gt;You mentioned that your dates are in same column. In this case, there are different solutions based on different data.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;1.&lt;/STRONG&gt; If the column only have two date rows.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;First add an index column in Power Query, then create a measure.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Date diff =
VAR Calendar1 =
    CALENDAR (
        MAXX ( FILTER ( ALL ( 'Table' ), 'Table'[Index] = 1 ), 'Table'[Date] ),
        MAXX ( FILTER ( ALL ( 'Table' ), 'Table'[Index] = 2 ), 'Table'[Date] )
    )
VAR Calendar2 =
    ADDCOLUMNS ( Calendar1, "WeekDay", WEEKDAY ( [Date], 2 ) )
RETURN
    COUNTX ( FILTER ( Calendar2, [WeekDay] &amp;lt; 6 ), [Date] )
&lt;/LI-CODE&gt;
&lt;P&gt;Get the result.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;2.&lt;/STRONG&gt; If there are multiple rows of dates in the column, and you want to compare the difference between every two rows of dates.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;First add an index column in Power Query, then create a measure.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Date diff2 =
VAR Calendar1 =
    CALENDAR (
        MAX ( 'Table'[Date] ),
        IF (
            MAX ( 'Table'[Index] ) &amp;lt;&amp;gt; MAXX ( ALL ( 'Table' ), 'Table'[Index] ),
            MAXX (
                FILTER ( ALL ( 'Table' ), 'Table'[Index] = MAX ( 'Table'[Index] ) + 1 ),
                'Table'[Date]
            ),
            MAX ( 'Table'[Date] )
        )
    )
VAR Calendar2 =
    ADDCOLUMNS ( Calendar1, "WeekDay", WEEKDAY ( [Date], 2 ) )
RETURN
    COUNTX ( FILTER ( Calendar2, [WeekDay] &amp;lt; 6 ), [Date] )
&lt;/LI-CODE&gt;
&lt;P&gt;Get the result.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;I attach my sample below for reference.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Community Support Team _ kalyj&lt;/P&gt;
&lt;P&gt;If this post&lt;SPAN&gt;&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;helps,&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;then please consider&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;to help the other members find it more quickly.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 May 2022 08:11:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-To-Calculate-Difference-Between-Dates-in-Same-Column/m-p/2512684#M69737</guid>
      <dc:creator>v-yanjiang-msft</dc:creator>
      <dc:date>2022-05-13T08:11:20Z</dc:date>
    </item>
  </channel>
</rss>

