<?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 many days in each month in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-many-days-in-each-month/m-p/1390105#M25467</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;, I attach &lt;A href="https://1drv.ms/u/s!AsDP3LYI8umsgQtWTHCYNas-BiWC?e=ofa88X" target="_blank" rel="noopener"&gt;&lt;EM&gt;&lt;STRONG&gt;a pbix file&lt;/STRONG&gt;&lt;/EM&gt;&lt;/A&gt; for your reference.&lt;/P&gt;</description>
    <pubDate>Wed, 23 Sep 2020 11:54:42 GMT</pubDate>
    <dc:creator>CNENFRNL</dc:creator>
    <dc:date>2020-09-23T11:54:42Z</dc:date>
    <item>
      <title>How many days in each month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-many-days-in-each-month/m-p/1387889#M25377</link>
      <description>&lt;P&gt;Hi guys!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to have one (ore more) measure that allows me to calculate how many days are between dates but in each month.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let's see the example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Start date = 14/08/2020&amp;nbsp;&lt;/P&gt;&lt;P&gt;End Date = 03/09/2020&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to know how many days are from August (month1) and how many days are from September (month2)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The idea is to calculate the number o Room Nights in a hotel stay, by month&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this example i would get the results :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;August =18 (31/08/2020 - 14-08/2020+1)&lt;/P&gt;&lt;P&gt;September =3 (03/09/2020-01/09/2020+1)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2020 15:53:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-many-days-in-each-month/m-p/1387889#M25377</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-09-22T15:53:33Z</dc:date>
    </item>
    <item>
      <title>Re: How many days in each month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-many-days-in-each-month/m-p/1387976#M25379</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt; , Try if this file can help&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.dropbox.com/s/bqbei7b8qbq5xez/leavebetweendates.pbix?dl=0" target="_blank"&gt;https://www.dropbox.com/s/bqbei7b8qbq5xez/leavebetweendates.pbix?dl=0&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2020 16:30:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-many-days-in-each-month/m-p/1387976#M25379</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2020-09-22T16:30:23Z</dc:date>
    </item>
    <item>
      <title>Re: How many days in each month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-many-days-in-each-month/m-p/1388276#M25394</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;, why bother to use DAX? Excel, the good old one, works perfectly; thanks to the intrinsic speciality of FREQUENCY func, it does the trick without any sweat.&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":beaming_face_with_smiling_eyes:"&gt;😁&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I attach &lt;A href="https://1drv.ms/x/s!AsDP3LYI8umsgQqNPjF_buPFGIaw?e=jcHxIF" target="_blank" rel="noopener"&gt;&lt;EM&gt;&lt;STRONG&gt;an Excel file&lt;/STRONG&gt;&lt;/EM&gt;&lt;/A&gt; for your reference. Have fun!&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2020 21:13:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-many-days-in-each-month/m-p/1388276#M25394</guid>
      <dc:creator>CNENFRNL</dc:creator>
      <dc:date>2020-09-22T21:13:32Z</dc:date>
    </item>
    <item>
      <title>Re: How many days in each month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-many-days-in-each-month/m-p/1389527#M25439</link>
      <description>A measure can return just one value. How do you want to return multiple values if the start and end dates are in different months?</description>
      <pubDate>Wed, 23 Sep 2020 08:04:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-many-days-in-each-month/m-p/1389527#M25439</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-09-23T08:04:03Z</dc:date>
    </item>
    <item>
      <title>Re: How many days in each month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-many-days-in-each-month/m-p/1389550#M25440</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="250150" data-lia-user-login="CNENFRNL" class="lia-mention lia-mention-user"&gt;CNENFRNL&lt;/a&gt;&amp;nbsp;but i need those values to complement a report with other values &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Sep 2020 08:14:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-many-days-in-each-month/m-p/1389550#M25440</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-09-23T08:14:28Z</dc:date>
    </item>
    <item>
      <title>Re: How many days in each month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-many-days-in-each-month/m-p/1389555#M25441</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;, thats why i wrote one (or more) measures&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Sep 2020 08:15:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-many-days-in-each-month/m-p/1389555#M25441</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-09-23T08:15:57Z</dc:date>
    </item>
    <item>
      <title>Re: How many days in each month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-many-days-in-each-month/m-p/1389919#M25459</link>
      <description>Hm... One measure would be more than enough. You should write just one measure that returns the number of days between any two dates and then do the rest by suitable slicing of the Date dimension. Proliferation of measures is never a good thing.</description>
      <pubDate>Wed, 23 Sep 2020 10:19:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-many-days-in-each-month/m-p/1389919#M25459</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-09-23T10:19:19Z</dc:date>
    </item>
    <item>
      <title>Re: How many days in each month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-many-days-in-each-month/m-p/1389946#M25461</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;, I came up with a Power Query solution, so that all data could be directly consumed by your reports, I hope.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;M codes are as follows, have fun once more!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":beaming_face_with_smiling_eyes:"&gt;😁&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTIyMDLQNbDQNTSBcyx1DYyVYnWilZzgQua6RijyFmB5Z7iQGUgIwTEyVYqNBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Custome = _t, #"Start Date" = _t, #"End Date" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Custome", type text}, {"Start Date", type date}, {"End Date", type date}}),
    
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each
        List.Generate(
            () =&amp;gt; [
                    s = [Start Date],
                    cm = Date.ToText(s, "yyyy/MM"),
                    stay = if [End Date] &amp;lt;= Date.EndOfMonth([Start Date]) then Duration.Days([End Date] - [Start Date]) + 1 else Duration.Days(Date.EndOfMonth([Start Date]) - [Start Date]) + 1
            ],
            (condition) =&amp;gt; condition[s] &amp;lt;= [End Date],
            (step) =&amp;gt; [
                s = Date.AddDays(Date.EndOfMonth(step[s]), 1),
                cm = Date.ToText(s, "yyyy/MM"),
                stay = if [End Date] &amp;lt;= Date.EndOfMonth(s) then Duration.Days([End Date] - s) + 1 else Date.DaysInMonth(s)
            ],
            each [yyyymm = [cm], Stay = [stay]]
        )
    ),
    #"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "Custom"),
    #"Expanded Custom1" = Table.ExpandRecordColumn(#"Expanded Custom", "Custom", {"yyyymm", "Stay"}, {"Year/Month", "Stay"})
in
    #"Expanded Custom1"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Sep 2020 10:43:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-many-days-in-each-month/m-p/1389946#M25461</guid>
      <dc:creator>CNENFRNL</dc:creator>
      <dc:date>2020-09-23T10:43:07Z</dc:date>
    </item>
    <item>
      <title>Re: How many days in each month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-many-days-in-each-month/m-p/1389980#M25462</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="250150" data-lia-user-login="CNENFRNL" class="lia-mention lia-mention-user"&gt;CNENFRNL&lt;/a&gt;&amp;nbsp;i think this could be the solution,&amp;nbsp;bur&amp;nbsp;&lt;SPAN&gt;I'm not very familiar with "M"... Could you send me the .pbix file just to try to understand? Thank you so much!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Sep 2020 10:49:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-many-days-in-each-month/m-p/1389980#M25462</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-09-23T10:49:45Z</dc:date>
    </item>
    <item>
      <title>Re: How many days in each month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-many-days-in-each-month/m-p/1390105#M25467</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;, I attach &lt;A href="https://1drv.ms/u/s!AsDP3LYI8umsgQtWTHCYNas-BiWC?e=ofa88X" target="_blank" rel="noopener"&gt;&lt;EM&gt;&lt;STRONG&gt;a pbix file&lt;/STRONG&gt;&lt;/EM&gt;&lt;/A&gt; for your reference.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Sep 2020 11:54:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-many-days-in-each-month/m-p/1390105#M25467</guid>
      <dc:creator>CNENFRNL</dc:creator>
      <dc:date>2020-09-23T11:54:42Z</dc:date>
    </item>
    <item>
      <title>Re: How many days in each month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-many-days-in-each-month/m-p/1396388#M25639</link>
      <description>&lt;P&gt;Thank you so much&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="250150" data-lia-user-login="CNENFRNL" class="lia-mention lia-mention-user"&gt;CNENFRNL&lt;/a&gt;&amp;nbsp;! i just get it work with your solution! Works great !&lt;span class="lia-unicode-emoji" title=":flexed_biceps:"&gt;💪&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Sep 2020 17:45:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-many-days-in-each-month/m-p/1396388#M25639</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-09-25T17:45:05Z</dc:date>
    </item>
  </channel>
</rss>

