<?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 Row on Grouped data in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Row-on-Grouped-data/m-p/2773405#M86435</link>
    <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;, my date column is a date/time and now the data set increased to few million rows this seems not to work anymore, keeps spinning forever is there any way to get around this?&lt;/P&gt;</description>
    <pubDate>Fri, 16 Sep 2022 11:55:31 GMT</pubDate>
    <dc:creator>georgec96</dc:creator>
    <dc:date>2022-09-16T11:55:31Z</dc:date>
    <item>
      <title>Previous Row on Grouped data</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Row-on-Grouped-data/m-p/2459796#M66528</link>
      <description>&lt;P&gt;Hi guys,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm having trouble writing a DAX formula that would give me the previous row for a dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Basically I have a table with the following columns : date, user, type, category, and time of transaction. I need to group my data by user, date, type category and then get the previous time of transaction for each user.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I believe this would be similiar to a PARTITION BY in SQL however I'm not sure how to achieve this in DAX.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Apr 2022 15:19:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Row-on-Grouped-data/m-p/2459796#M66528</guid>
      <dc:creator>georgec96</dc:creator>
      <dc:date>2022-04-16T15:19:31Z</dc:date>
    </item>
    <item>
      <title>Re: Previous Row on Grouped data</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Row-on-Grouped-data/m-p/2459803#M66529</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="357242" data-lia-user-login="georgec96" class="lia-mention lia-mention-user"&gt;georgec96&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please share some sample data and mimic the expected results?&lt;/P&gt;</description>
      <pubDate>Sat, 16 Apr 2022 15:40:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Row-on-Grouped-data/m-p/2459803#M66529</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-04-16T15:40:26Z</dc:date>
    </item>
    <item>
      <title>Re: Previous Row on Grouped data</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Row-on-Grouped-data/m-p/2461182#M66625</link>
      <description>&lt;DIV&gt;&lt;SPAN&gt;Previuos Time Per User = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt; &lt;SPAN&gt;_current_time&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;PreviousTime[time]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt; &lt;SPAN&gt;_table&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATETABLE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;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gt;&lt;SPAN&gt;PreviousTime[time]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;_result&lt;BR /&gt;&lt;BR /&gt;This version will return blank in case there weren't any rows with time before (as in the first row in that day for that user). If you want this to show the previous time also when it was in the previous date than best to add another column with date and time and do the calculation of the max and previous on it. In this case you need to remove the VALUES(PreviousTime[Date]) from the measure I wrote&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 18 Apr 2022 08:53:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Row-on-Grouped-data/m-p/2461182#M66625</guid>
      <dc:creator>SpartaBI</dc:creator>
      <dc:date>2022-04-18T08:53:32Z</dc:date>
    </item>
    <item>
      <title>Re: Previous Row on Grouped data</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Row-on-Grouped-data/m-p/2461184#M66626</link>
      <description>&lt;DIV&gt;&lt;SPAN&gt;Previuos Time Per User = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt; &lt;SPAN&gt;_current_time&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;PreviousTime[time]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt; &lt;SPAN&gt;_table&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATETABLE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&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t;&lt;SPAN&gt;PreviousTime[time]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;_result&lt;BR /&gt;&lt;BR /&gt;This version will return blank in case there weren't any rows with time before (as in the first row in that day for that user). If you want this to show the previous time also when it was in the previous date than best to add another column with date and time and do the calculation of the max and previous on it. In this case you need to remove the VALUES(PreviousTime[Date]) from the measure I wrote&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 18 Apr 2022 08:53:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Row-on-Grouped-data/m-p/2461184#M66626</guid>
      <dc:creator>SpartaBI</dc:creator>
      <dc:date>2022-04-18T08:53:47Z</dc:date>
    </item>
    <item>
      <title>Re: Previous Row on Grouped data</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Row-on-Grouped-data/m-p/2462584#M66738</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="357242" data-lia-user-login="georgec96" class="lia-mention lia-mention-user"&gt;georgec96&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I have created a simple sample, please refer to my pbix file to see if it helps you.&lt;/P&gt;
&lt;P&gt;Create a column.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Previous transaction date = 
var currentDate =A[Transaction date]
var currentCustomer =A[client]
var currentProduct = A[product_name]
return
CALCULATE(MAX(A[Transaction date]),
    FILTER(ALL(A),
        A[Transaction date] &amp;lt; currentDate
        &amp;amp;&amp;amp; A[client] = currentCustomer
	&amp;amp;&amp;amp; A[product_name] = currentProduct
    )
)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;If I have misunderstood your meaning, please provide your pbi file without privacy information and your desired output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;
&lt;P&gt;Community Support Team _ Polly&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 05:36:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Row-on-Grouped-data/m-p/2462584#M66738</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-04-19T05:36:01Z</dc:date>
    </item>
    <item>
      <title>Re: Previous Row on Grouped data</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Row-on-Grouped-data/m-p/2773405#M86435</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;, my date column is a date/time and now the data set increased to few million rows this seems not to work anymore, keeps spinning forever is there any way to get around this?&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 11:55:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Row-on-Grouped-data/m-p/2773405#M86435</guid>
      <dc:creator>georgec96</dc:creator>
      <dc:date>2022-09-16T11:55:31Z</dc:date>
    </item>
    <item>
      <title>Re: Previous Row on Grouped data</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Row-on-Grouped-data/m-p/2773439#M86441</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="357242" data-lia-user-login="georgec96" class="lia-mention lia-mention-user"&gt;georgec96&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;I did a small modification on&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;formula. Please try&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Previous transaction date =
VAR CurrentDate = A[Transaction date]
VAR T1 =
    CALCULATETABLE ( A, ALLEXCEPT ( A, A[client], A[product_name] ) )
VAR T2 =
    FILTER ( T1, A[Transaction date] &amp;lt; CurrentDate )
RETURN
    MAXX ( T2, A[Transaction date] )&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 16 Sep 2022 12:03:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Previous-Row-on-Grouped-data/m-p/2773439#M86441</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-09-16T12:03:57Z</dc:date>
    </item>
  </channel>
</rss>

