<?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: Number of Months between two dates in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Number-of-Months-between-two-dates/m-p/90008#M3196</link>
    <description>&lt;P&gt;I had a similar question, but for my case, I want the formula to be sensitive to the day of month&amp;nbsp;as well as the month of the year. For this, I added&amp;nbsp;an offset of -1 to your formula above any time the day of the end date is less than the day of the start date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So number of months between Jan 15 and Feb 10 is "0", while number of months between Jan 15 and Feb&amp;nbsp;20 is "1".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;(12*(Date.Year([EndDate])-Date.Year([StartDate])))&lt;/P&gt;&lt;P&gt;+ (Date.Month([EndDate]) - Date.Month([StartDate]))&lt;/P&gt;&lt;P&gt;+ (if Date.Day([EndDate]) &amp;lt; Date.Day([StartDate]) then -1 else 0)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 15 Nov 2016 18:38:45 GMT</pubDate>
    <dc:creator>aaronsteers</dc:creator>
    <dc:date>2016-11-15T18:38:45Z</dc:date>
    <item>
      <title>Number of Months between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Number-of-Months-between-two-dates/m-p/16837#M197</link>
      <description>&lt;P&gt;This seems like a really dumb thing to be asking.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to count the number of Months between two dates. &amp;nbsp;I can happily find out the number of days, but that doesn't help much as number of days in a month varies. &amp;nbsp;This can easily be done in Excel using DateDiff but I cannot figure out how to do this in PowerQuery. &amp;nbsp;I need that figure to move to the next step of my query.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The only other thing that might do this is if I could get a count of a group of rows. &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd enjoy figuring t this out for myself if I had the time but I need to get this done quickly so any hints gratefully received.&lt;/P&gt;</description>
      <pubDate>Sat, 30 Jan 2016 09:54:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Number-of-Months-between-two-dates/m-p/16837#M197</guid>
      <dc:creator>trevb</dc:creator>
      <dc:date>2016-01-30T09:54:35Z</dc:date>
    </item>
    <item>
      <title>Re: Number of Months between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Number-of-Months-between-two-dates/m-p/16840#M198</link>
      <description>&lt;P&gt;It is the same function in DAX as Excel. Create a measure like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Months = DATEDIFF([start],[end],MONTH)&lt;/PRE&gt;&lt;P&gt;&lt;A href="https://msdn.microsoft.com/en-us/library/dn802538.aspx" target="_blank"&gt;https://msdn.microsoft.com/en-us/library/dn802538.aspx&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;EDIT: Hang on, just caught the reference to PowerQuery, give me a minute.&lt;/P&gt;</description>
      <pubDate>Sat, 30 Jan 2016 12:52:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Number-of-Months-between-two-dates/m-p/16840#M198</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2016-01-30T12:52:26Z</dc:date>
    </item>
    <item>
      <title>Re: Number of Months between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Number-of-Months-between-two-dates/m-p/16841#M199</link>
      <description>&lt;P&gt;A work in progress, but maybe will help some:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;let
    Source = Csv.Document(File.Contents("C:\temp\powerbi\months.csv"),[Delimiter=",", Encoding=1252]),
    #"Promoted Headers" = Table.PromoteHeaders(Source),
    #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"start", type date}, {"end", type date}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Years", each Number.RoundDown(Duration.Days(([end] - [start]) / 365.25),0)),
    #"Added Custom1" = Table.AddColumn(#"Added Custom", "Days Left", each Number.Mod(Duration.Days(([end] - [start])),365.25)),
    #"Added Custom2" = Table.AddColumn(#"Added Custom1", "StartMonth", each Date.Month([start])),
    #"Added Custom3" = Table.AddColumn(#"Added Custom2", "EndMonth", each Date.Month([end])),
    #"Added Custom4" = Table.AddColumn(#"Added Custom3", "Months", each [Years]*12 + ([EndMonth] - [StartMonth]))
in
    #"Added Custom4"&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;startendYearsDays LeftStartMonthEndMonthMonths&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;1/1/2015&lt;/TD&gt;&lt;TD&gt;1/29/2016&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;27.75&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;12&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1/29/2015&lt;/TD&gt;&lt;TD&gt;1/6/2016&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;342&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;6/12/2014&lt;/TD&gt;&lt;TD&gt;7/2/2016&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;20.5&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;7&lt;/TD&gt;&lt;TD&gt;25&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Need to fix that middle row obviously.&lt;/P&gt;</description>
      <pubDate>Sat, 30 Jan 2016 13:25:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Number-of-Months-between-two-dates/m-p/16841#M199</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2016-01-30T13:25:53Z</dc:date>
    </item>
    <item>
      <title>Re: Number of Months between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Number-of-Months-between-two-dates/m-p/16842#M200</link>
      <description>&lt;P&gt;That data table should look like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;start &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;end &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Years &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Days Left &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; StartMonth &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; EndMonth &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Months&lt;/P&gt;&lt;P&gt;1/1/2015 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1/29/2016 &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;27.75 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;12&lt;/P&gt;&lt;P&gt;1/29/2015 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1/6/2016 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;342 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/P&gt;&lt;P&gt;6/12/2014 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;7/2/2016 &amp;nbsp; &amp;nbsp; &amp;nbsp; 2 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;20.5 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 6 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 7 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;25&lt;/P&gt;</description>
      <pubDate>Sat, 30 Jan 2016 13:29:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Number-of-Months-between-two-dates/m-p/16842#M200</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2016-01-30T13:29:41Z</dc:date>
    </item>
    <item>
      <title>Re: Number of Months between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Number-of-Months-between-two-dates/m-p/16843#M201</link>
      <description>&lt;P&gt;This gives me the correct answer for all of the rows, but I know there is a boundary case I am probably not accounting for:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;let
    Source = Csv.Document(File.Contents("C:\temp\powerbi\months.csv"),[Delimiter=",", Encoding=1252]),
    #"Promoted Headers" = Table.PromoteHeaders(Source),
    #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"start", type date}, {"end", type date}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Years", each ([end] - [start]) / 365.25),
    #"Changed Type1" = Table.TransformColumnTypes(#"Added Custom",{{"Years", Int64.Type}}),
    #"Added Custom1" = Table.AddColumn(#"Changed Type1", "Days Left", each Number.Mod(Duration.Days(([end] - [start])),365.25)),
    #"Added Custom2" = Table.AddColumn(#"Added Custom1", "StartMonth", each Date.Month([start])),
    #"Added Custom3" = Table.AddColumn(#"Added Custom2", "EndMonth", each Date.Month([end])),
    #"Added Custom4" = Table.AddColumn(#"Added Custom3", "Months", each [Years]*12 + ([EndMonth] - [StartMonth]))
in
    #"Added Custom4"&lt;/PRE&gt;</description>
      <pubDate>Sat, 30 Jan 2016 13:33:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Number-of-Months-between-two-dates/m-p/16843#M201</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2016-01-30T13:33:20Z</dc:date>
    </item>
    <item>
      <title>Re: Number of Months between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Number-of-Months-between-two-dates/m-p/16853#M202</link>
      <description />
      <pubDate>Sat, 30 Jan 2016 17:56:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Number-of-Months-between-two-dates/m-p/16853#M202</guid>
      <dc:creator>trevb</dc:creator>
      <dc:date>2016-01-30T17:56:05Z</dc:date>
    </item>
    <item>
      <title>Re: Number of Months between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Number-of-Months-between-two-dates/m-p/16854#M203</link>
      <description>&lt;P&gt;Many thanks for this. &amp;nbsp;Especially 'cos I managed to post it in the wrong part of the forum!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think I'm going to fail with this anyway. &amp;nbsp;What I was trying to do was to add a row for every month between two dates. &amp;nbsp;I am able to do that and it works fine on my test data so I was working on the rest which included working out what a monthly figure for budget would be, which is why I needed the count above. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried something using Group to get a table with a count of the number of rows added using the above and that worked so I kept going. &amp;nbsp;Alas when I replaced the test data with the final data all went Pete Tong. &amp;nbsp;The query fails with a Stack Overflow error presumably because the table it is trying to create is just too big. &amp;nbsp;It does this &amp;nbsp;just adding the rows before I get to the bit where I need the count of months. &amp;nbsp;There are 173 records in the table but honestly I did not think this would be too much as I have previously done this natively in a spreadsheet. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I can fix the row adding I will try again but using your suggestions rather than generating another table which could be sucking up memory.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again.&lt;/P&gt;</description>
      <pubDate>Sat, 30 Jan 2016 18:05:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Number-of-Months-between-two-dates/m-p/16854#M203</guid>
      <dc:creator>trevb</dc:creator>
      <dc:date>2016-01-30T18:05:13Z</dc:date>
    </item>
    <item>
      <title>Re: Number of Months between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Number-of-Months-between-two-dates/m-p/16857#M204</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/3409"&gt;@trevb﻿&lt;/a&gt;&amp;nbsp;- No problem, if you can post some sample, sanitized data and explain what you are ultimately trying to achieve (end result I am still not clear on) then we might be able to come up with a solution. 173 records should be trivial for Power BI to ingest and process. Some problems are trivial in DAX, like Months between dates and we might be able to get to a solution easier doing the necessary data manipulation in DAX and Power BI modeling rather than purely in "M".&lt;/P&gt;</description>
      <pubDate>Sat, 30 Jan 2016 18:26:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Number-of-Months-between-two-dates/m-p/16857#M204</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2016-01-30T18:26:06Z</dc:date>
    </item>
    <item>
      <title>Re: Number of Months between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Number-of-Months-between-two-dates/m-p/19829#M298</link>
      <description>&lt;P&gt;Just as an aside to this, I would recommend anyone using Power BI as a serious tool to get hold of this book:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A title="Definitive Dax" href="http://www.amazon.com/Definitive-Guide-DAX-intelligence-Microsoft/dp/073569835X/ref=sr_1_1?ie=UTF8&amp;amp;qid=1455975416&amp;amp;sr=8-1&amp;amp;keywords=definitive+dax" target="_blank"&gt;http://www.amazon.com/Definitive-Guide-DAX-intelligence-Microsoft/dp/073569835X/ref=sr_1_1?ie=UTF8&amp;amp;qid=1455975416&amp;amp;sr=8-1&amp;amp;keywords=definitive+dax&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is certainly not an easy read if you're very new to DAX or Excel formulas, but it has a wealth of information and will answer pretty much every question you might have.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 20 Feb 2016 13:41:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Number-of-Months-between-two-dates/m-p/19829#M298</guid>
      <dc:creator>PaulAlford</dc:creator>
      <dc:date>2016-02-20T13:41:13Z</dc:date>
    </item>
    <item>
      <title>Re: Number of Months between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Number-of-Months-between-two-dates/m-p/20211#M311</link>
      <description>&lt;P&gt;Ta Paul&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I already have that but thanks for the tip.&amp;nbsp; Sadly this time I needed to be using Power Query just because I am using the information in both PowerBI and Excel and that was the easiest way to bring them together.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Feb 2016 12:27:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Number-of-Months-between-two-dates/m-p/20211#M311</guid>
      <dc:creator>trevb</dc:creator>
      <dc:date>2016-02-23T12:27:11Z</dc:date>
    </item>
    <item>
      <title>Re: Number of Months between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Number-of-Months-between-two-dates/m-p/22711#M391</link>
      <description>&lt;P&gt;Will not this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Date.Month([DateTime1]) - Date.Month([DateTime2])&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;work for you?&lt;/P&gt;</description>
      <pubDate>Thu, 10 Mar 2016 22:14:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Number-of-Months-between-two-dates/m-p/22711#M391</guid>
      <dc:creator>AverageAsker</dc:creator>
      <dc:date>2016-03-10T22:14:22Z</dc:date>
    </item>
    <item>
      <title>Re: Number of Months between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Number-of-Months-between-two-dates/m-p/22754#M396</link>
      <description>&lt;P&gt;I should have done an update on this.&amp;nbsp; What I went with was&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;((Date.Year([EndDate])-Date.Year([StartDate]))*12) + Date.Month([EndDate]) - Date.Month([StartDate])&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This works fine for me and matches the results I was looking to achieve.&amp;nbsp; I sped my exisiting query up by an order of magnitude &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Still really wish there was a DateDiff equivalent built into the query language though &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2016 07:40:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Number-of-Months-between-two-dates/m-p/22754#M396</guid>
      <dc:creator>trevb</dc:creator>
      <dc:date>2016-03-11T07:40:14Z</dc:date>
    </item>
    <item>
      <title>Re: Number of Months between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Number-of-Months-between-two-dates/m-p/90008#M3196</link>
      <description>&lt;P&gt;I had a similar question, but for my case, I want the formula to be sensitive to the day of month&amp;nbsp;as well as the month of the year. For this, I added&amp;nbsp;an offset of -1 to your formula above any time the day of the end date is less than the day of the start date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So number of months between Jan 15 and Feb 10 is "0", while number of months between Jan 15 and Feb&amp;nbsp;20 is "1".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;(12*(Date.Year([EndDate])-Date.Year([StartDate])))&lt;/P&gt;&lt;P&gt;+ (Date.Month([EndDate]) - Date.Month([StartDate]))&lt;/P&gt;&lt;P&gt;+ (if Date.Day([EndDate]) &amp;lt; Date.Day([StartDate]) then -1 else 0)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Nov 2016 18:38:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Number-of-Months-between-two-dates/m-p/90008#M3196</guid>
      <dc:creator>aaronsteers</dc:creator>
      <dc:date>2016-11-15T18:38:45Z</dc:date>
    </item>
    <item>
      <title>Re: Number of Months between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Number-of-Months-between-two-dates/m-p/213246#M6727</link>
      <description>&lt;P&gt;I use this expression to evaluate a list of dates relative to today.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It returns 0 if the date&amp;nbsp;is within the current month&lt;/P&gt;&lt;P&gt;-1 if the date is in the preceding month&amp;nbsp;&lt;/P&gt;&lt;P&gt;+1 if the date is in next month.&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can easily be adapted for other uses (Day, Week, Quarter).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;OrdMonth = if(today()&amp;lt;CAL[Date],datediff(today(),CAL[Date],MONTH),datediff(CAL[Date],today(),MONTH)*-1)&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jul 2017 15:29:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Number-of-Months-between-two-dates/m-p/213246#M6727</guid>
      <dc:creator>drmbrklyn</dc:creator>
      <dc:date>2017-07-17T15:29:15Z</dc:date>
    </item>
    <item>
      <title>Re: Number of Months between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Number-of-Months-between-two-dates/m-p/213252#M6728</link>
      <description>&lt;P&gt;I use this formula in a calucated column of my date table:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;OrdMonth = if(today()&amp;lt;CAL[Date],datediff(today(),CAL[Date],MONTH),datediff(CAL[Date],today(),MONTH)*-1)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It returns:&lt;/P&gt;&lt;P&gt;0 if the date is in the current month&lt;/P&gt;&lt;P&gt;-1 if the date is in the previous month&lt;/P&gt;&lt;P&gt;+1 if the dates in the next month&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Its' great to filter for windows of time (last three months, within 3 months before and after)&lt;/P&gt;&lt;P&gt;It's easy to adapt for use with Years, Days or Weeks.&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can also swap out the "Today" argument for a different, specific date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This also solves the issue with datediff where the start date cannot be after the end date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jul 2017 15:39:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Number-of-Months-between-two-dates/m-p/213252#M6728</guid>
      <dc:creator>drmbrklyn</dc:creator>
      <dc:date>2017-07-17T15:39:52Z</dc:date>
    </item>
    <item>
      <title>Re: Number of Months between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Number-of-Months-between-two-dates/m-p/312710#M9238</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This, although it's not really elegant, does the job to get the (rounded) number of months between two dates:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; Number.Round(Number.From([End Date]) - Number.From([Begin Date]) / 30.4, 0)&lt;/PRE&gt;&lt;P&gt;Cheers&lt;/P&gt;</description>
      <pubDate>Tue, 28 Nov 2017 13:22:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Number-of-Months-between-two-dates/m-p/312710#M9238</guid>
      <dc:creator>StephLef</dc:creator>
      <dc:date>2017-11-28T13:22:20Z</dc:date>
    </item>
    <item>
      <title>Re: Number of Months between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Number-of-Months-between-two-dates/m-p/666149#M19056</link>
      <description>&lt;P&gt;How do you have fixed the problem in middle row?&lt;/P&gt;</description>
      <pubDate>Wed, 10 Apr 2019 07:57:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Number-of-Months-between-two-dates/m-p/666149#M19056</guid>
      <dc:creator>noesk-fl</dc:creator>
      <dc:date>2019-04-10T07:57:53Z</dc:date>
    </item>
    <item>
      <title>Re: Number of Months between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Number-of-Months-between-two-dates/m-p/836593#M21282</link>
      <description>&lt;P&gt;To have a Decimal number i use:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Date.Month([EndDate])-Date.Month([StartDate])&lt;BR /&gt;+&lt;BR /&gt;((Date.Day([EndDate])/Date.DaysInMonth([EndDate])) + (Duration.TotalDays(Date.EndOfMonth([StartDate])-[StartDate])/Date.DaysInMonth([StartDate]))-1))&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2019 20:46:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Number-of-Months-between-two-dates/m-p/836593#M21282</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-11-04T20:46:35Z</dc:date>
    </item>
    <item>
      <title>Re: Number of Months between two dates</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Number-of-Months-between-two-dates/m-p/1479883#M26382</link>
      <description>&lt;P&gt;I have created following function to cover all possbile scenerio. it will give the accurate result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Function Body:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;= (StartDate as datetime,EndDate as datetime) =&amp;gt; let
        Source = {Number.From(#date(Date.Year(StartDate),Date.Month(StartDate),Date.Day(StartDate)))..Number.From(#date(Date.Year(EndDate),Date.Month(EndDate),Date.Day(EndDate)))},
        #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
        #"Changed Type" = Table.TransformColumnTypes(#"Converted to Table",{{"Column1", type date}}),
        #"Added Custom" = Table.AddColumn(#"Changed Type", "Month Year", each Date.ToText([Column1],"MMM-yyyy")),
        #"Grouped Rows" = Table.Group(#"Added Custom", {"Month Year"}, {{"Count", each Table.RowCount(_), Int64.Type}}),
        #"Counted Rows" = Table.RowCount(#"Grouped Rows")
    in
        #"Counted Rows"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Invoked example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;let
    Source = getTotalMonths(#datetime(2020, 11, 11, 0, 0, 0), #datetime(2023, 07, 11, 0, 0, 0))
in
    Source&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Nov 2020 18:45:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Number-of-Months-between-two-dates/m-p/1479883#M26382</guid>
      <dc:creator>Bhautik</dc:creator>
      <dc:date>2020-11-06T18:45:27Z</dc:date>
    </item>
  </channel>
</rss>

