<?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: Calculate month end dates between two dates in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-month-end-dates-between-two-dates/m-p/2773156#M86409</link>
    <description>&lt;P&gt;You could add a End of Month column to your date table and then use&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Months count =
VAR StartDate =
    SELECTEDVALUE ( 'Table'[Start date] )
VAR EndDate =
    SELECTEDVALUE ( 'Table'[End date] )
VAR Result =
    CALCULATE (
        COUNTROWS ( VALUES ( 'Date'[End of month] ) ),
        DATESBETWEEN ( 'Date'[Date], StartDate, EndDate )
    )
RETURN
    Result
&lt;/LI-CODE&gt;</description>
    <pubDate>Fri, 16 Sep 2022 10:16:57 GMT</pubDate>
    <dc:creator>johnt75</dc:creator>
    <dc:date>2022-09-16T10:16:57Z</dc:date>
    <item>
      <title>Calculate month end dates between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-month-end-dates-between-two-dates/m-p/2773116#M86403</link>
      <description>&lt;P&gt;I need to count the number of month end dates between two dates. I've tried using DATEDIFF but cannot quite make this work with the added requirement of counting month end dates.&lt;BR /&gt;&lt;BR /&gt;In the example below I've shown the months count results I would expect to see by calculating the month end dates crossed between the two dates. If the start or end date lands on the month end then they count as being crossed.&lt;BR /&gt;&lt;BR /&gt;Start date&amp;nbsp; &amp;nbsp; &amp;nbsp;End Date&amp;nbsp; &amp;nbsp; &amp;nbsp;Months count&lt;BR /&gt;01/08/22&amp;nbsp; &amp;nbsp; &amp;nbsp;30/08/22&amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;BR /&gt;20/08/22&amp;nbsp; &amp;nbsp; &amp;nbsp;31/08/22&amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;BR /&gt;31/08/22&amp;nbsp; &amp;nbsp; &amp;nbsp;01/09/22&amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;BR /&gt;31/08/22&amp;nbsp; &amp;nbsp; &amp;nbsp;30/09/22&amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;BR /&gt;20/08/22&amp;nbsp; &amp;nbsp; &amp;nbsp;01/09/22&amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;BR /&gt;20/08/22&amp;nbsp; &amp;nbsp; &amp;nbsp;30/09/22&amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;BR /&gt;20/08/22&amp;nbsp; &amp;nbsp; &amp;nbsp;31/07/23&amp;nbsp; &amp;nbsp; &amp;nbsp;12&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone suggest a solution to this?&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 10:02:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-month-end-dates-between-two-dates/m-p/2773116#M86403</guid>
      <dc:creator>paultaylor006</dc:creator>
      <dc:date>2022-09-16T10:02:28Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate month end dates between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-month-end-dates-between-two-dates/m-p/2773156#M86409</link>
      <description>&lt;P&gt;You could add a End of Month column to your date table and then use&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Months count =
VAR StartDate =
    SELECTEDVALUE ( 'Table'[Start date] )
VAR EndDate =
    SELECTEDVALUE ( 'Table'[End date] )
VAR Result =
    CALCULATE (
        COUNTROWS ( VALUES ( 'Date'[End of month] ) ),
        DATESBETWEEN ( 'Date'[Date], StartDate, EndDate )
    )
RETURN
    Result
&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 16 Sep 2022 10:16:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-month-end-dates-between-two-dates/m-p/2773156#M86409</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2022-09-16T10:16:57Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate month end dates between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-month-end-dates-between-two-dates/m-p/2786322#M87346</link>
      <description>&lt;P&gt;I found a slightly different solution by creating an end of month column for the start date, and then then using an end of month calc for the end date but adding a day to the end date to push it into the next month if it fell on the month end date. This allowed me to accruately count month ends.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This was the dax I used below and '&lt;SPAN&gt;StartDate_EndofMonth' iis the&amp;nbsp; end of month column I created for the start date.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Months count = &lt;/SPAN&gt;&lt;SPAN&gt;DATEDIFF&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;EOMONTH&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'table'&lt;/SPAN&gt;&lt;SPAN&gt;[StartDate_EndofMonth]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;), &lt;/SPAN&gt;&lt;SPAN&gt;EOMONTH&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'table'&lt;/SPAN&gt;&lt;SPAN&gt;[End Date]&lt;/SPAN&gt;&lt;SPAN&gt;+&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;MONTH&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Sep 2022 08:50:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-month-end-dates-between-two-dates/m-p/2786322#M87346</guid>
      <dc:creator>paultaylor006</dc:creator>
      <dc:date>2022-09-22T08:50:27Z</dc:date>
    </item>
  </channel>
</rss>

