<?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 Days in Two Months Based on Start and End Date in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Days-in-Two-Months-Based-on-Start-and-End-Date/m-p/4155810#M165146</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="779321" data-lia-user-login="dvraan" class="lia-mention lia-mention-user"&gt;dvraan&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When using FORMAT(MONTH(StartDate), “mmm”, “en-US”), it interprets MONTH(StartDate) as a number (e.g., 9 for September) and formatted as a date. To get the correct month name, you should format the entire date, not just the month number. You can refer to the program provided by lbendlin&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your Current Period does not refer to this, please clarify in a follow-up reply.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Clara Gong&lt;/P&gt;
&lt;P&gt;If there is any post&amp;nbsp;&lt;STRONG&gt;&lt;I&gt;helps&lt;/I&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;I&gt;Accept it as the solution&lt;/I&gt;&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;</description>
    <pubDate>Wed, 18 Sep 2024 05:54:23 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-09-18T05:54:23Z</dc:date>
    <item>
      <title>Calculate Days in Two Months Based on Start and End Date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Days-in-Two-Months-Based-on-Start-and-End-Date/m-p/4155228#M165126</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;EVALUATE
VAR StartDate = DATE(2024, 9, 17)   
VAR EndDate = DATE(2024, 10, 5)    

-- Find the last day of the start month (September)
VAR EndOfStartMonth = EOMONTH(StartDate, 0)

-- Calculate the number of days in the start month (September)
VAR DaysInStartMonth = DATEDIFF(StartDate, EndOfStartMonth, DAY) + 1

-- Calculate the number of days in the end month (October)
VAR StartOfEndMonth = DATE(YEAR(EndDate), MONTH(EndDate), 1)
VAR DaysInEndMonth = DATEDIFF(StartOfEndMonth, EndDate, DAY) + 1

-- Return the result
RETURN
    UNION (
        ROW ( "Month",  FORMAT(MONTH(StartDate), "mmmm", "en-US"), "Days", DaysInStartMonth ),
        ROW ( "Month", FORMAT(MONTH(EndDate), "mmmm", "en-US"), "Days", DaysInEndMonth )
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;without using format function i get correct month like 09,10 as month. but when i pass month(startDate) to format function returns only January as month. Any why it does that?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Month Days&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;January&lt;/TD&gt;&lt;TD&gt;14&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;January&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to get&lt;/P&gt;&lt;P&gt;Month Days&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;September&lt;/TD&gt;&lt;TD&gt;14&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;October&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Tue, 17 Sep 2024 21:21:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Days-in-Two-Months-Based-on-Start-and-End-Date/m-p/4155228#M165126</guid>
      <dc:creator>dvraan</dc:creator>
      <dc:date>2024-09-17T21:21:28Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Days in Two Months Based on Start and End Date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Days-in-Two-Months-Based-on-Start-and-End-Date/m-p/4155295#M165129</link>
      <description>&lt;LI-CODE lang="markup"&gt;EVALUATE
VAR StartDate = DATE(2024, 9, 17)   
VAR EndDate = DATE(2024, 10, 5)    

-- Find the last day of the start month (September)
VAR EndOfStartMonth = EOMONTH(StartDate, 0)

-- Calculate the number of days in the start month (September)
VAR DaysInStartMonth = DATEDIFF(StartDate, EndOfStartMonth, DAY) + 1

-- Calculate the number of days in the end month (October)
VAR StartOfEndMonth = DATE(YEAR(EndDate), MONTH(EndDate), 1)
VAR DaysInEndMonth = DATEDIFF(StartOfEndMonth, EndDate, DAY) + 1

-- Return the result
RETURN
    UNION (
        ROW ( "Month",  FORMAT(StartDate, "mmmm", "en-US"), "Days", DaysInStartMonth ),
        ROW ( "Month", FORMAT(EndDate, "mmmm", "en-US"), "Days", DaysInEndMonth )
    )&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 17 Sep 2024 23:22:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Days-in-Two-Months-Based-on-Start-and-End-Date/m-p/4155295#M165129</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-09-17T23:22:00Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Days in Two Months Based on Start and End Date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Days-in-Two-Months-Based-on-Start-and-End-Date/m-p/4155810#M165146</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="779321" data-lia-user-login="dvraan" class="lia-mention lia-mention-user"&gt;dvraan&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When using FORMAT(MONTH(StartDate), “mmm”, “en-US”), it interprets MONTH(StartDate) as a number (e.g., 9 for September) and formatted as a date. To get the correct month name, you should format the entire date, not just the month number. You can refer to the program provided by lbendlin&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your Current Period does not refer to this, please clarify in a follow-up reply.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Clara Gong&lt;/P&gt;
&lt;P&gt;If there is any post&amp;nbsp;&lt;STRONG&gt;&lt;I&gt;helps&lt;/I&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;I&gt;Accept it as the solution&lt;/I&gt;&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Sep 2024 05:54:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Days-in-Two-Months-Based-on-Start-and-End-Date/m-p/4155810#M165146</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-09-18T05:54:23Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Days in Two Months Based on Start and End Date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Days-in-Two-Months-Based-on-Start-and-End-Date/m-p/4158068#M165230</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="100342" data-lia-user-login="lbendlin" class="lia-mention lia-mention-user"&gt;lbendlin&lt;/a&gt;&amp;nbsp;both answers were helpful. Thanks again&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2024 00:08:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Days-in-Two-Months-Based-on-Start-and-End-Date/m-p/4158068#M165230</guid>
      <dc:creator>dvraan</dc:creator>
      <dc:date>2024-09-19T00:08:23Z</dc:date>
    </item>
  </channel>
</rss>

