<?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: Previous Month before  current month in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Month-before-current-month/m-p/117199#M209</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="9805" data-lia-user-login="Angel" class="lia-mention lia-mention-user"&gt;Angel&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try using PREVIOUSMONTH function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CheenuSing&lt;/P&gt;</description>
    <pubDate>Mon, 23 Jan 2017 05:28:08 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-01-23T05:28:08Z</dc:date>
    <item>
      <title>Previous Month before  current month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Month-before-current-month/m-p/111363#M194</link>
      <description>&lt;P&gt;Hi, everybody&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need a phormula that calculates a value of the previous month before the current one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't want to use slicers to select the month. There has to be something&amp;nbsp;'invisible' for end user.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried this: &amp;nbsp;&lt;EM&gt;REVPAR previous month&amp;nbsp;= CALCULATE(SUM('REVPAR/REVPAG'[Amount)/SUM('REVPAR/REVPAG'[Capacity]);FILTER(DimDate;DimDate[Month]=MONTH(TODAY())-1);FILTER(DimDate;DimDate[Year]=YEAR(TODAY())))&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you can see, it doesn't work because current month is Jan-2017 and the phormula refers to Dic-2017.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any tip?.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2017 16:16:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Month-before-current-month/m-p/111363#M194</guid>
      <dc:creator>Angel</dc:creator>
      <dc:date>2017-01-10T16:16:39Z</dc:date>
    </item>
    <item>
      <title>Re: Previous Month before  current month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Month-before-current-month/m-p/117199#M209</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="9805" data-lia-user-login="Angel" class="lia-mention lia-mention-user"&gt;Angel&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try using PREVIOUSMONTH function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CheenuSing&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2017 05:28:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Month-before-current-month/m-p/117199#M209</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-01-23T05:28:08Z</dc:date>
    </item>
    <item>
      <title>Re: Previous Month before  current month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Month-before-current-month/m-p/120205#M219</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;Anonymous&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think if I use PreviusMonth i must select a month in slicer. This is not the thing I want to do.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to show previousmonth before current without select month in a slicer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It must be dynamicilly, &amp;nbsp;without user interaction.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyway, I have created a boolean column that indicates if sales date is in the previusmonth.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I filter by true, It works.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks, anyway&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2017 11:52:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Month-before-current-month/m-p/120205#M219</guid>
      <dc:creator>Angel</dc:creator>
      <dc:date>2017-01-30T11:52:49Z</dc:date>
    </item>
    <item>
      <title>Re: Previous Month before  current month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Month-before-current-month/m-p/3403007#M128538</link>
      <description>&lt;P&gt;The issue with your formula is when the current month is January (i.e., MONTH(TODAY()) = 1). Subtracting 1 directly from the month gives December (i.e., MONTH(TODAY()) - 1 = 0), but it also fails to adjust the year backwards, hence you get Dec-2017 instead of Dec-2016.&lt;/P&gt;
&lt;P&gt;You need to account for the change in year when you try to get the previous month from January.&lt;/P&gt;
&lt;P&gt;Here's a way to handle this:&lt;/P&gt;
&lt;P&gt;REVPAR previous month = &lt;BR /&gt;VAR PrevMonth = EDATE(TODAY(), -1) &lt;BR /&gt;RETURN&lt;BR /&gt;CALCULATE(&lt;BR /&gt;SUM('REVPAR/REVPAG'[Amount]) / SUM('REVPAR/REVPAG'[Capacity]),&lt;BR /&gt;FILTER(&lt;BR /&gt;DimDate,&lt;BR /&gt;DimDate[Month] = MONTH(PrevMonth) &amp;amp;&amp;amp; DimDate[Year] = YEAR(PrevMonth)&lt;BR /&gt;)&lt;BR /&gt;)&lt;BR /&gt;Let's break down the formula:&lt;/P&gt;
&lt;P&gt;The EDATE function is used to get the exact date one month before today. This function will handle the year transition seamlessly. So, if the current month is January 2017, PrevMonth will be set to December 2016.&lt;BR /&gt;The main calculation then sums the values for 'REVPAR/REVPAG'[Amount] and divides by the sum of 'REVPAR/REVPAG'[Capacity] for that particular month and year of PrevMonth.&lt;BR /&gt;With this formula, there's no need for slicers or user input, and it will automatically calculate values for the month just prior to the current month. Adjust the formula as needed based on your actual table and column names if they differ from the ones provided.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Aug 2023 20:45:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Month-before-current-month/m-p/3403007#M128538</guid>
      <dc:creator>technolog</dc:creator>
      <dc:date>2023-08-28T20:45:22Z</dc:date>
    </item>
  </channel>
</rss>

