<?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: Counting days in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-days/m-p/2549225#M72080</link>
    <description>&lt;P&gt;thx for help, but it is still not working... have you got maybe 5 min to call you teams? I will send you gift from poland &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 31 May 2022 06:34:50 GMT</pubDate>
    <dc:creator>FILIPKACZMAR</dc:creator>
    <dc:date>2022-05-31T06:34:50Z</dc:date>
    <item>
      <title>Counting days</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-days/m-p/2541514#M71593</link>
      <description>&lt;P&gt;Hello everyone!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new at Power BI community (learning) and I have got a little problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At my new work I got the task to repair our PowerBI dashboard.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have to count days between two dates, and I wrote this code:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Obliczanie bez weekendow = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;COUNTROWS&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;FILTER&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ADD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gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;And I got error, that start date could not be later than end day. In some rows it is like this, so why error is everywhere?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I am thinking about using IF function, to make program miss these rows. But I dont know how.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Can you help me?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thank you very much all &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 26 May 2022 13:17:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-days/m-p/2541514#M71593</guid>
      <dc:creator>FILIPKACZMAR</dc:creator>
      <dc:date>2022-05-26T13:17:50Z</dc:date>
    </item>
    <item>
      <title>Re: Counting days</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-days/m-p/2541538#M71595</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;You can use DATESBETWEEN function:&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;DatesBtwn = &lt;/SPAN&gt;&lt;SPAN&gt;DATESBETWEEN&lt;/SPAN&gt;&lt;SPAN&gt;(Calendar&lt;/SPAN&gt;&lt;SPAN&gt;[Date]&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;[End of Inspection]&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;[Delivered Report]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I will attach a report that shows a few examples of using either DATESBETWEEN or DATESINPERIOD. You should create a Date Table (MODELING&amp;gt;NEW TABLE&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;and mak as Date Table and connect to Fact Table. This will allow you to do time intel calculations.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;A title="DatesBetween - DIP" href="https://drive.google.com/file/d/1cNo0LnI91xyzJa02tcVirlRzosjA3A8N/view?usp=sharing" target="_self"&gt;https://drive.google.com/file/d/1cNo0LnI91xyzJa02tcVirlRzosjA3A8N/view?usp=sharing&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Date Table Code:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;P&gt;Dates = ADDCOLUMNS ( CALENDAR (FIRSTDATE(Sheet1[&amp;nbsp;Date]), TODAY()), "year", YEAR ( [Date] ), "MonthNumber", FORMAT ( [Date], "MM" ), "year-month", FORMAT ( [Date], "YYYY-MM" ), "month-year", FORMAT ( [Date], "MM-'YY" ) )&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 26 May 2022 13:31:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-days/m-p/2541538#M71595</guid>
      <dc:creator>Whitewater100</dc:creator>
      <dc:date>2022-05-26T13:31:24Z</dc:date>
    </item>
    <item>
      <title>Re: Counting days</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-days/m-p/2541660#M71603</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="393303" data-lia-user-login="FILIPKACZMAR" class="lia-mention lia-mention-user"&gt;FILIPKACZMAR&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes you can wrap CALENDAR with IF like&lt;/P&gt;&lt;P&gt;If ( 'SQA list'[End of Inspection].[Date] &amp;lt; 'SQA list'[Delivered Report].[Date],&lt;BR /&gt;CALENDAR ( 'SQA list'[End of Inspection].[Date], 'SQA list'[Delivered Report].[Date] ),&lt;BR /&gt;"Day of Week", WEEKDAY ( [Date], 2 )&lt;BR /&gt;))&lt;/P&gt;&lt;P&gt;the error will go but not sure about the results&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2022 14:35:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-days/m-p/2541660#M71603</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-05-26T14:35:25Z</dc:date>
    </item>
    <item>
      <title>Re: Counting days</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-days/m-p/2547156#M71968</link>
      <description>&lt;P&gt;THX for help, but I have got another error with code: to much argument, max for if is only 3&amp;nbsp;&lt;/P&gt;&lt;P&gt;:(((&lt;/P&gt;</description>
      <pubDate>Mon, 30 May 2022 08:30:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-days/m-p/2547156#M71968</guid>
      <dc:creator>FILIPKACZMAR</dc:creator>
      <dc:date>2022-05-30T08:30:45Z</dc:date>
    </item>
    <item>
      <title>Re: Counting days</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-days/m-p/2547168#M71970</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="393303" data-lia-user-login="FILIPKACZMAR" class="lia-mention lia-mention-user"&gt;FILIPKACZMAR&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please paste the complete code in a reply in order to check it.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 May 2022 08:33:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-days/m-p/2547168#M71970</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-05-30T08:33:44Z</dc:date>
    </item>
    <item>
      <title>Re: Counting days</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-days/m-p/2547254#M71973</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;= &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;COUNTROWS&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;If&lt;/SPAN&gt;&lt;SPAN&gt; ( &lt;/SPAN&gt;&lt;SPAN&gt;'SQA list'[End of Inspection]&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;[Date]&lt;/SPAN&gt;&lt;SPAN&gt; &amp;lt; &lt;/SPAN&gt;&lt;SPAN&gt;'SQA list'[Delivered Report]&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;[Date]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALENDAR&lt;/SPAN&gt;&lt;SPAN&gt; ( &lt;/SPAN&gt;&lt;SPAN&gt;'SQA list'[End of Inspection]&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;[Date]&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'SQA list'[Delivered Report]&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;[Date]&lt;/SPAN&gt;&lt;SPAN&gt; ),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;"Day of Week"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;WEEKDAY&lt;/SPAN&gt;&lt;SPAN&gt; ( &lt;/SPAN&gt;&lt;SPAN&gt;[Date]&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;2&lt;/SPAN&gt;&lt;SPAN&gt; )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 30 May 2022 08:59:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-days/m-p/2547254#M71973</guid>
      <dc:creator>FILIPKACZMAR</dc:creator>
      <dc:date>2022-05-30T08:59:03Z</dc:date>
    </item>
    <item>
      <title>Re: Counting days</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-days/m-p/2547263#M71975</link>
      <description>&lt;P&gt;last [Date] is not collored&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 May 2022 09:00:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-days/m-p/2547263#M71975</guid>
      <dc:creator>FILIPKACZMAR</dc:creator>
      <dc:date>2022-05-30T09:00:25Z</dc:date>
    </item>
    <item>
      <title>Re: Counting days</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-days/m-p/2547553#M71984</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="393303" data-lia-user-login="FILIPKACZMAR" class="lia-mention lia-mention-user"&gt;FILIPKACZMAR&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Please use the following&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;=
VAR First = 'SQA list'[End of Inspection].[Date]
VAR Last = 'SQA list'[Delivered Report].[Date]
VAR First1 =
    IF ( First &amp;lt;= Last, First, Last - 1 )
VAR Last1 =
    IF ( First &amp;lt;= Last, Last, First1 )
RETURN
    COUNTROWS (
        FILTER (
            ADDCOLUMNS ( CALENDAR ( First1, Last1 ), "Day of Week", WEEKDAY ( [Date], 2 ) ),
            [Day of Week] &amp;lt;&amp;gt; 6
                &amp;amp;&amp;amp; [Day of Week] &amp;lt;&amp;gt; 7
        )
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 May 2022 10:25:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-days/m-p/2547553#M71984</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-05-30T10:25:49Z</dc:date>
    </item>
    <item>
      <title>Re: Counting days</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-days/m-p/2549225#M72080</link>
      <description>&lt;P&gt;thx for help, but it is still not working... have you got maybe 5 min to call you teams? I will send you gift from poland &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 May 2022 06:34:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Counting-days/m-p/2549225#M72080</guid>
      <dc:creator>FILIPKACZMAR</dc:creator>
      <dc:date>2022-05-31T06:34:50Z</dc:date>
    </item>
  </channel>
</rss>

