<?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 Record Count when Date is the 'Global' Latest Month minus 1 in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Record-Count-when-Date-is-the-Global-Latest-Month-minus-1/m-p/2716801#M82719</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have only recently realsied that this is a problem but am now struggling to find a solution. I have a measure that counts records in the latest month minus 1. This appeared to be working fine with the DAX below but I have relaised that if you put this into a table broken down by person (for example) it will give you the latest month minus 1 for each individual. I need it to be the latest month minus 1 for the entire data set but whatever I add seems to break the measure.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;LastMonthCases = &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;MASTER_DATA[RecordCount]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;MASTER_DATA[CreatedMonthAndYear]&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;edate&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;max&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;MASTER_DATA[CreatedMonthAndYear]&lt;/SPAN&gt;&lt;SPAN&gt;),-&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I have tried adding a "Calculate" and "ALL" to the MAX part but it doesn't seem to like that.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Any hints or tips would be great.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thanks in advance.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Mon, 22 Aug 2022 11:40:21 GMT</pubDate>
    <dc:creator>Topjacket</dc:creator>
    <dc:date>2022-08-22T11:40:21Z</dc:date>
    <item>
      <title>Record Count when Date is the 'Global' Latest Month minus 1</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Record-Count-when-Date-is-the-Global-Latest-Month-minus-1/m-p/2716801#M82719</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have only recently realsied that this is a problem but am now struggling to find a solution. I have a measure that counts records in the latest month minus 1. This appeared to be working fine with the DAX below but I have relaised that if you put this into a table broken down by person (for example) it will give you the latest month minus 1 for each individual. I need it to be the latest month minus 1 for the entire data set but whatever I add seems to break the measure.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;LastMonthCases = &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;MASTER_DATA[RecordCount]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;MASTER_DATA[CreatedMonthAndYear]&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;edate&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;max&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;MASTER_DATA[CreatedMonthAndYear]&lt;/SPAN&gt;&lt;SPAN&gt;),-&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I have tried adding a "Calculate" and "ALL" to the MAX part but it doesn't seem to like that.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Any hints or tips would be great.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thanks in advance.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 22 Aug 2022 11:40:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Record-Count-when-Date-is-the-Global-Latest-Month-minus-1/m-p/2716801#M82719</guid>
      <dc:creator>Topjacket</dc:creator>
      <dc:date>2022-08-22T11:40:21Z</dc:date>
    </item>
    <item>
      <title>Re: Record Count when Date is the 'Global' Latest Month minus 1</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Record-Count-when-Date-is-the-Global-Latest-Month-minus-1/m-p/2717103#M82738</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="372268" data-lia-user-login="Topjacket" class="lia-mention lia-mention-user"&gt;Topjacket&lt;/a&gt; , You need have table with Month year(Say Date)&amp;nbsp; and Rank, join back with you table on year month &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then you can have column in that table&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Month Rank = RANKX(all('Date'),'Date'[year month ],,ASC,Dense)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and have measures like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This Month = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Month Rank]=max('Date'[Month Rank])))&lt;BR /&gt;Last Month = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Month Rank]=max('Date'[Month Rank])-1))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;latest -1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Last Month =&lt;/P&gt;
&lt;P&gt;var _max = maxx(allselected('Date') ,'Date'[Month Rank])&lt;/P&gt;
&lt;P&gt;return&lt;/P&gt;
&lt;P&gt;CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Month Rank]=_max -1))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Aug 2022 12:59:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Record-Count-when-Date-is-the-Global-Latest-Month-minus-1/m-p/2717103#M82738</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2022-08-22T12:59:08Z</dc:date>
    </item>
    <item>
      <title>Re: Record Count when Date is the 'Global' Latest Month minus 1</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Record-Count-when-Date-is-the-Global-Latest-Month-minus-1/m-p/2717181#M82743</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;amitchandak&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Really appreciate the quick reply.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Aug 2022 13:18:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Record-Count-when-Date-is-the-Global-Latest-Month-minus-1/m-p/2717181#M82743</guid>
      <dc:creator>Topjacket</dc:creator>
      <dc:date>2022-08-22T13:18:16Z</dc:date>
    </item>
  </channel>
</rss>

