<?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: Convert Earlier function in DAX to Power Query (Reverse Cumulative) in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Convert-Earlier-function-in-DAX-to-Power-Query-Reverse/m-p/1714432#M35401</link>
    <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;, here's the M code for your reference,&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcjQ0NFTSUfIozU3MUwhKLc4vLUpOLQaKGBkYGeoaAJGxUqwONdWZIKtzy8xLzEtOxWkOFnlTCuVNyHEnHnWm5IQPIXfROlzoEI8Q+5yMiDOHsDpjctThDGfc8qYE5IHmxwIA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Project = _t, Department = _t, Date = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Project", type text}, {"Department", type text}, {"Date", type date}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Date", "Project", "Department"}, {{"Count", each Table.RowCount(_), Int64.Type}}),

    #"Reverse Cumulative Count" = Table.AddColumn(#"Grouped Rows", "Reverse Cumulative Count", each List.Sum(Table.SelectRows(#"Grouped Rows", (x) =&amp;gt; x[Project] = [Project] and x[Department] = [Department] and x[Date] &amp;gt;= [Date])[Count]))
//                               ^^^^^^^^^^^^^^^^^
//                             it's equivalent to EARLIER()
in
    #"Reverse Cumulative Count"&lt;/LI-CODE&gt;</description>
    <pubDate>Wed, 10 Mar 2021 16:45:02 GMT</pubDate>
    <dc:creator>CNENFRNL</dc:creator>
    <dc:date>2021-03-10T16:45:02Z</dc:date>
    <item>
      <title>Convert Earlier function in DAX to Power Query (Reverse Cumulative)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Convert-Earlier-function-in-DAX-to-Power-Query-Reverse/m-p/1712466#M35347</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Apologies in advance but I cannot seem to find a solution to this question.&lt;/P&gt;&lt;P&gt;Basically,&amp;nbsp;I wrote a DAX query that works perfectly, but i realised a Power query will be better because I need Power's pivot functionality for some required post analysis. I just started learning DAX and have no idea how to write power queries.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the query, I created two variables &lt;EM&gt;_department &amp;amp; _project&amp;nbsp;&lt;/EM&gt;and execute the following:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;EM&gt;CALCULATE(COUNTROWS('Table'),FILTER('Table',__department='Table'[department]),FILTER('Table',__project='Table'[Project type]),FILTER('Table','Table'[date]&amp;gt;=EARLIER('Table'[date]))&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;The query filters the table by department and project, then does a reverse cummulative count on the filtered results, grouped by dates.&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Any idea would be a good starting point for me.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thanks&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 10 Mar 2021 01:11:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Convert-Earlier-function-in-DAX-to-Power-Query-Reverse/m-p/1712466#M35347</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-03-10T01:11:39Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Earlier function in DAX to Power Query (Reverse Cumulative)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Convert-Earlier-function-in-DAX-to-Power-Query-Reverse/m-p/1713313#M35353</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;, as to your DAX formula alone, it could be simplified as&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;CALCULATE (
    COUNTROWS ( 'Table' ),
    FILTER (
        'Table',
        'Table'[department] = __department
            &amp;amp;&amp;amp; 'Table'[Project type] = __project
            &amp;amp;&amp;amp; 'Table'[date] &amp;gt;= EARLIER ( 'Table'[date] )
    )
)&lt;/LI-CODE&gt;
&lt;P&gt;as to the equivalence to EARLIER(), I think you can conduct some filtering after grouping the dataset by columns [&lt;SPAN&gt;department] and [Project&amp;nbsp;type]. Paste some mockup data for further explanation if you want.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 09:52:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Convert-Earlier-function-in-DAX-to-Power-Query-Reverse/m-p/1713313#M35353</guid>
      <dc:creator>CNENFRNL</dc:creator>
      <dc:date>2021-03-10T09:52:05Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Earlier function in DAX to Power Query (Reverse Cumulative)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Convert-Earlier-function-in-DAX-to-Power-Query-Reverse/m-p/1714294#M35393</link>
      <description>&lt;P&gt;Hey,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have been having some challenges replying. Made several attempts for over an hour. Something about '&lt;SPAN&gt;Post flooding detected (community received posts of a unique message more than 1 times within 3,600'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I hope this works!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://drive.google.com/file/d/1NUkbPY9QuN1amKgMCpdgEHgU_I33MspY/view?usp=sharing" target="_blank" rel="noopener"&gt;My response to your question&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 16:03:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Convert-Earlier-function-in-DAX-to-Power-Query-Reverse/m-p/1714294#M35393</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-03-10T16:03:18Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Earlier function in DAX to Power Query (Reverse Cumulative)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Convert-Earlier-function-in-DAX-to-Power-Query-Reverse/m-p/1714432#M35401</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;, here's the M code for your reference,&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcjQ0NFTSUfIozU3MUwhKLc4vLUpOLQaKGBkYGeoaAJGxUqwONdWZIKtzy8xLzEtOxWkOFnlTCuVNyHEnHnWm5IQPIXfROlzoEI8Q+5yMiDOHsDpjctThDGfc8qYE5IHmxwIA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Project = _t, Department = _t, Date = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Project", type text}, {"Department", type text}, {"Date", type date}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Date", "Project", "Department"}, {{"Count", each Table.RowCount(_), Int64.Type}}),

    #"Reverse Cumulative Count" = Table.AddColumn(#"Grouped Rows", "Reverse Cumulative Count", each List.Sum(Table.SelectRows(#"Grouped Rows", (x) =&amp;gt; x[Project] = [Project] and x[Department] = [Department] and x[Date] &amp;gt;= [Date])[Count]))
//                               ^^^^^^^^^^^^^^^^^
//                             it's equivalent to EARLIER()
in
    #"Reverse Cumulative Count"&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 10 Mar 2021 16:45:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Convert-Earlier-function-in-DAX-to-Power-Query-Reverse/m-p/1714432#M35401</guid>
      <dc:creator>CNENFRNL</dc:creator>
      <dc:date>2021-03-10T16:45:02Z</dc:date>
    </item>
    <item>
      <title>Re: Convert Earlier function in DAX to Power Query (Reverse Cumulative)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Convert-Earlier-function-in-DAX-to-Power-Query-Reverse/m-p/1714472#M35402</link>
      <description>&lt;P&gt;Thanks so much. Will try and out and revert. Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 17:04:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Convert-Earlier-function-in-DAX-to-Power-Query-Reverse/m-p/1714472#M35402</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-03-10T17:04:42Z</dc:date>
    </item>
  </channel>
</rss>

