<?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: Count calendar days per natural year in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-calendar-days-per-natural-year/m-p/3072147#M106683</link>
    <description>&lt;P&gt;Crazy solution but works!!!&lt;BR /&gt;Thank you very much&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 09 Feb 2023 14:39:10 GMT</pubDate>
    <dc:creator>Ricardo76</dc:creator>
    <dc:date>2023-02-09T14:39:10Z</dc:date>
    <item>
      <title>Count calendar days per natural year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-calendar-days-per-natural-year/m-p/3071736#M106655</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;I have a table with many records, including a start date field and an end date field:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;ID&lt;/TD&gt;&lt;TD&gt;START DATE&lt;/TD&gt;&lt;TD&gt;END DATE&lt;/TD&gt;&lt;TD&gt;...more fields&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1568&lt;/TD&gt;&lt;TD&gt;2023-01-01&lt;/TD&gt;&lt;TD&gt;2023-01-15&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;65605&lt;/TD&gt;&lt;TD&gt;2023-01-01&lt;/TD&gt;&lt;TD&gt;2023-01-08&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;354863&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;2023-02-01&lt;/TD&gt;&lt;TD&gt;2023-02-06&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to calculate how many days per year are included between the start date and the end date of all records. in this case they would be: 21. 15 days of first row, 0 day of second row (It is already counting in the first row) and 6 days of&amp;nbsp;third row.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope I explained myself well, thank you very much&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2023 11:36:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-calendar-days-per-natural-year/m-p/3071736#M106655</guid>
      <dc:creator>Ricardo76</dc:creator>
      <dc:date>2023-02-09T11:36:15Z</dc:date>
    </item>
    <item>
      <title>Re: Count calendar days per natural year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-calendar-days-per-natural-year/m-p/3071823#M106662</link>
      <description>&lt;P&gt;please try&amp;nbsp;&lt;/P&gt;&lt;P&gt;Total Days =&lt;BR /&gt;SUMX(&lt;BR /&gt;'Table',&lt;BR /&gt;IF(YEAR( 'Table'[END DATE] ) = YEAR( 'Table'[START DATE] ),&lt;BR /&gt;DATEDIFF( 'Table'[START DATE], 'Table'[END DATE], DAY ),&lt;BR /&gt;DATEDIFF( 'Table'[START DATE], DATE(YEAR( 'Table'[END DATE] ), 12, 31), DAY ) +&lt;BR /&gt;DATEDIFF( DATE(YEAR( 'Table'[END DATE] ), 1, 1), 'Table'[END DATE], DAY )&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2023 12:43:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-calendar-days-per-natural-year/m-p/3071823#M106662</guid>
      <dc:creator>jaweher899</dc:creator>
      <dc:date>2023-02-09T12:43:51Z</dc:date>
    </item>
    <item>
      <title>Re: Count calendar days per natural year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-calendar-days-per-natural-year/m-p/3071851#M106666</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="512121" data-lia-user-login="Ricardo76" class="lia-mention lia-mention-user"&gt;Ricardo76&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;This is a crazy solution. In fact I don't expect best performance but it works. Please refer to attached sample file with the proposed solution.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This solution provides you expected total result (21) as in a card visual but shall not provide correct result at row level.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Calendar Days = 
VAR String = 
    CONCATENATEX ( 
        'Table',
        CONCATENATEX ( CALENDAR ( 'Table'[START DATE], 'Table'[END DATE] ), [Date], "," ),
        ","
    )
VAR Items = SUBSTITUTE ( String, ",", "|" )
VAR Length = PATHLENGTH ( Items )
VAR T1 = GENERATESERIES ( 1, Length, 1 )
VAR T2 = SELECTCOLUMNS ( T1, "@Date", PATHITEM ( Items, [Value] ) )
VAR T3 = DISTINCT ( T2 )
RETURN
    COUNTROWS ( T3 )&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 09 Feb 2023 12:59:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-calendar-days-per-natural-year/m-p/3071851#M106666</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-02-09T12:59:46Z</dc:date>
    </item>
    <item>
      <title>Re: Count calendar days per natural year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-calendar-days-per-natural-year/m-p/3072127#M106680</link>
      <description>&lt;P&gt;Thanks, but the solution doesn't work on my model. Because he is adding the days and not counting. Each year cannot add more than 365 days.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2023 14:32:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-calendar-days-per-natural-year/m-p/3072127#M106680</guid>
      <dc:creator>Ricardo76</dc:creator>
      <dc:date>2023-02-09T14:32:38Z</dc:date>
    </item>
    <item>
      <title>Re: Count calendar days per natural year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-calendar-days-per-natural-year/m-p/3072147#M106683</link>
      <description>&lt;P&gt;Crazy solution but works!!!&lt;BR /&gt;Thank you very much&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2023 14:39:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-calendar-days-per-natural-year/m-p/3072147#M106683</guid>
      <dc:creator>Ricardo76</dc:creator>
      <dc:date>2023-02-09T14:39:10Z</dc:date>
    </item>
    <item>
      <title>Re: Count calendar days per natural year</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-calendar-days-per-natural-year/m-p/3074395#M106831</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="512121" data-lia-user-login="Ricardo76" class="lia-mention lia-mention-user"&gt;Ricardo76&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;The following solution is simpler and more efficient.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Calendar Days 2 = 
COUNTROWS (
    DISTINCT (
        SELECTCOLUMNS (
            GENERATE ( 
                'Table',
                CALENDAR ( 'Table'[START DATE], 'Table'[END DATE] )
            ),
            "@Date",
            [Date]
        )
    )
)&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 10 Feb 2023 11:07:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Count-calendar-days-per-natural-year/m-p/3074395#M106831</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-02-10T11:07:32Z</dc:date>
    </item>
  </channel>
</rss>

