<?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: Divide months from day 16 to 15 in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Divide-months-from-day-16-to-15/m-p/1948605#M42421</link>
    <description>&lt;P&gt;I'd suggest having a date table in your model that includes a column that categorises dates into your required buckets.&lt;/P&gt;&lt;P&gt;eg&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;Calendar Month&lt;/TD&gt;&lt;TD&gt;Categorisation Month&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;13-Feb-21&lt;/TD&gt;&lt;TD&gt;February&lt;/TD&gt;&lt;TD&gt;January&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;14-Feb-21&lt;/TD&gt;&lt;TD&gt;February&lt;/TD&gt;&lt;TD&gt;January&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;15-Feb-21&lt;/TD&gt;&lt;TD&gt;February&lt;/TD&gt;&lt;TD&gt;January&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;16-Feb-21&lt;/TD&gt;&lt;TD&gt;February&lt;/TD&gt;&lt;TD&gt;February&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;17-Feb-21&lt;/TD&gt;&lt;TD&gt;February&lt;/TD&gt;&lt;TD&gt;February&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;18-Feb-21&lt;/TD&gt;&lt;TD&gt;February&lt;/TD&gt;&lt;TD&gt;February&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;19-Feb-21&lt;/TD&gt;&lt;TD&gt;February&lt;/TD&gt;&lt;TD&gt;February&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
    <pubDate>Fri, 09 Jul 2021 16:05:39 GMT</pubDate>
    <dc:creator>PaulOlding</dc:creator>
    <dc:date>2021-07-09T16:05:39Z</dc:date>
    <item>
      <title>Divide months from day 16 to 15</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Divide-months-from-day-16-to-15/m-p/1948342#M42416</link>
      <description>&lt;P&gt;Good afternoon,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to analyze data over one-month periods. But the beginning of the month is always at 16.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;January 16th to February 15th&lt;/P&gt;&lt;P&gt;February 16th to March 15th&lt;/P&gt;&lt;P&gt;March 16th to April 15th&lt;/P&gt;&lt;P&gt;Etc...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;How can I do this?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jul 2021 14:05:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Divide-months-from-day-16-to-15/m-p/1948342#M42416</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-07-09T14:05:13Z</dc:date>
    </item>
    <item>
      <title>Re: Divide months from day 16 to 15</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Divide-months-from-day-16-to-15/m-p/1948605#M42421</link>
      <description>&lt;P&gt;I'd suggest having a date table in your model that includes a column that categorises dates into your required buckets.&lt;/P&gt;&lt;P&gt;eg&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;Calendar Month&lt;/TD&gt;&lt;TD&gt;Categorisation Month&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;13-Feb-21&lt;/TD&gt;&lt;TD&gt;February&lt;/TD&gt;&lt;TD&gt;January&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;14-Feb-21&lt;/TD&gt;&lt;TD&gt;February&lt;/TD&gt;&lt;TD&gt;January&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;15-Feb-21&lt;/TD&gt;&lt;TD&gt;February&lt;/TD&gt;&lt;TD&gt;January&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;16-Feb-21&lt;/TD&gt;&lt;TD&gt;February&lt;/TD&gt;&lt;TD&gt;February&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;17-Feb-21&lt;/TD&gt;&lt;TD&gt;February&lt;/TD&gt;&lt;TD&gt;February&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;18-Feb-21&lt;/TD&gt;&lt;TD&gt;February&lt;/TD&gt;&lt;TD&gt;February&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;19-Feb-21&lt;/TD&gt;&lt;TD&gt;February&lt;/TD&gt;&lt;TD&gt;February&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Fri, 09 Jul 2021 16:05:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Divide-months-from-day-16-to-15/m-p/1948605#M42421</guid>
      <dc:creator>PaulOlding</dc:creator>
      <dc:date>2021-07-09T16:05:39Z</dc:date>
    </item>
    <item>
      <title>Re: Divide months from day 16 to 15</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Divide-months-from-day-16-to-15/m-p/1948807#M42446</link>
      <description>&lt;P&gt;I have a data table with:&lt;/P&gt;&lt;P&gt;Data; Day Name; Day of Week; MMM; Month; Month Name; Month ID; Year; YYMM&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do I have a simple way to do this categorization? Or do I have to create a table manually?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jul 2021 17:41:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Divide-months-from-day-16-to-15/m-p/1948807#M42446</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-07-09T17:41:12Z</dc:date>
    </item>
    <item>
      <title>Re: Divide months from day 16 to 15</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Divide-months-from-day-16-to-15/m-p/1948992#M42463</link>
      <description>&lt;P&gt;What does it mean manually? If you have a table with dates, then it's easy to write a formula that will do the categorisation automatically. Since you know that MonthN (Month01, Month02,..., Month12) starts on the 16th and ends on the 15th of the next month it does not take a long time to actually come up with a formula...&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jul 2021 19:36:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Divide-months-from-day-16-to-15/m-p/1948992#M42463</guid>
      <dc:creator>daxer-almighty</dc:creator>
      <dc:date>2021-07-09T19:36:49Z</dc:date>
    </item>
    <item>
      <title>Re: Divide months from day 16 to 15</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Divide-months-from-day-16-to-15/m-p/1949018#M42466</link>
      <description>&lt;P&gt;If I knew how to make the formula, I wouldn't be on this page asking for support. Can you help me? Please?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jul 2021 19:54:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Divide-months-from-day-16-to-15/m-p/1949018#M42466</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-07-09T19:54:14Z</dc:date>
    </item>
    <item>
      <title>Re: Divide months from day 16 to 15</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Divide-months-from-day-16-to-15/m-p/1949042#M42467</link>
      <description>&lt;P&gt;Power Query's probably the best place for this:&lt;/P&gt;&lt;P&gt;= Table.AddColumn(#"Previous Step", "Categorisation Month", each if [Day]&amp;gt; 15 then [Month Name] else Date.MonthName(Date.AddMonths([Date], -1)), type text)&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jul 2021 20:07:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Divide-months-from-day-16-to-15/m-p/1949042#M42467</guid>
      <dc:creator>PaulOlding</dc:creator>
      <dc:date>2021-07-09T20:07:17Z</dc:date>
    </item>
    <item>
      <title>Re: Divide months from day 16 to 15</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Divide-months-from-day-16-to-15/m-p/1949065#M42468</link>
      <description>&lt;P&gt;Drop this into DAX Studio and execute:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;EVALUATE
var Dates = 
    SELECTCOLUMNS(
        CALENDAR( "2020-01-01", "2021-12-31" ),
        "@Date", [Date]
    )
return
SELECTCOLUMNS(
    ADDCOLUMNS(
        Dates,
        "@Bucket",
            var CurrentDate = [@Date]
            var CurrentMonth = month( CurrentDate )
            var CurrentDay = day( CurrentDate )
            var Bucket =
                switch( true(),
                    15 &amp;lt; CurrentDay, CurrentMonth,
                    CurrentMonth - 1
                )
            return
                Bucket
    ),
    "Date", [@Date],
    "Bucket", 
        "Month_" &amp;amp; format(
            if( [@Bucket] = 0, 12, [@Bucket] ),
            "00"
        )
)&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 09 Jul 2021 20:16:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Divide-months-from-day-16-to-15/m-p/1949065#M42468</guid>
      <dc:creator>daxer-almighty</dc:creator>
      <dc:date>2021-07-09T20:16:08Z</dc:date>
    </item>
    <item>
      <title>Re: Divide months from day 16 to 15</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Divide-months-from-day-16-to-15/m-p/1949095#M42471</link>
      <description>&lt;P&gt;Another variation with month names is this:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;EVALUATE
var Dates = CALENDAR( "2020-01-01", "2021-12-31" )
return
    ADDCOLUMNS(
        Dates,
        "Bucket",
            var CurrentDate = [Date]
            var CurrentMonth = month( CurrentDate )
            var CurrentDay = day( CurrentDate )
            var BucketMonthNumber =
                switch( true(),
                    15 &amp;lt; CurrentDay, CurrentMonth,
                    if( CurrentMonth - 1 = 0, 
                        12, 
                        CurrentMonth - 1
                    )
                )
            var Bucket =
                format(
                    date( 2020, BucketMonthNumber, 1 ),
                    "MMM"
                )
            return
                Bucket
    )&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 09 Jul 2021 20:31:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Divide-months-from-day-16-to-15/m-p/1949095#M42471</guid>
      <dc:creator>daxer-almighty</dc:creator>
      <dc:date>2021-07-09T20:31:07Z</dc:date>
    </item>
  </channel>
</rss>

