<?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 how to get date value from another row in the same table? in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/how-to-get-date-value-from-another-row-in-the-same-table/m-p/3637684#M140765</link>
    <description>&lt;P&gt;Hi,&lt;BR /&gt;I have a challenge to get a date value from another row in the same table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table with timestamps and status changes (old status and new status). What I try to achieve is getting the start date and the end date of a specific status (in progress). Since I only have the timestamp of the "change date", I'll have to find timestamp of the row where the NewValue is "in progress", and add that to the row where OldValue is "in progress". That way I have the lead time of that status. sounds simple but a few extra challenges:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;- I use a DirectQuery (and want to continue doing so) so can not edit the PowerQuery and e.g. creating an index is not allowed;&lt;/P&gt;&lt;P&gt;- Table of the timestamps contain more than 1mio results what causes error's in visuals;&lt;/P&gt;&lt;P&gt;- An Item can have the in progress state multiple times, what should result in multiple leadtimes which I want to summarize in another formula once this one is fixed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Formula that (I think) is very close (but doesn't work in the visuals since query is exceeding 1mio results):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;PreviousDate = 
VAR PreviousRow =
            FILTER(
            all(TIMEDURATION_REQUEST_TASK),
            COUNTROWS(
                TOPN(
                    1,
                    FILTER(
                        TIMEDURATION_REQUEST_TASK,
                        TIMEDURATION_REQUEST_TASK[ChangedOnDateTime] &amp;lt; EARLIER(TIMEDURATION_REQUEST_TASK[ChangedOnDateTime])
                        &amp;amp;&amp;amp;TIMEDURATION_REQUEST_TASK[NewValue] = "In Progress"
                    ),
                TIMEDURATION_REQUEST_TASK[ChangedOnDateTime],ASC
    )))
VAR PreviousValue =
    MINX(PreviousRow,[ChangedOnDateTime])
RETURN PreviousValue&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; here a prt screen of an example of the data I have to work with:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Number&lt;/EM&gt; is the unique ticket the specific timestamps are referring to.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Hope someone has an answer &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 14 Jan 2024 17:37:38 GMT</pubDate>
    <dc:creator>maxnuij</dc:creator>
    <dc:date>2024-01-14T17:37:38Z</dc:date>
    <item>
      <title>how to get date value from another row in the same table?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/how-to-get-date-value-from-another-row-in-the-same-table/m-p/3637684#M140765</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;I have a challenge to get a date value from another row in the same table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table with timestamps and status changes (old status and new status). What I try to achieve is getting the start date and the end date of a specific status (in progress). Since I only have the timestamp of the "change date", I'll have to find timestamp of the row where the NewValue is "in progress", and add that to the row where OldValue is "in progress". That way I have the lead time of that status. sounds simple but a few extra challenges:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;- I use a DirectQuery (and want to continue doing so) so can not edit the PowerQuery and e.g. creating an index is not allowed;&lt;/P&gt;&lt;P&gt;- Table of the timestamps contain more than 1mio results what causes error's in visuals;&lt;/P&gt;&lt;P&gt;- An Item can have the in progress state multiple times, what should result in multiple leadtimes which I want to summarize in another formula once this one is fixed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Formula that (I think) is very close (but doesn't work in the visuals since query is exceeding 1mio results):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;PreviousDate = 
VAR PreviousRow =
            FILTER(
            all(TIMEDURATION_REQUEST_TASK),
            COUNTROWS(
                TOPN(
                    1,
                    FILTER(
                        TIMEDURATION_REQUEST_TASK,
                        TIMEDURATION_REQUEST_TASK[ChangedOnDateTime] &amp;lt; EARLIER(TIMEDURATION_REQUEST_TASK[ChangedOnDateTime])
                        &amp;amp;&amp;amp;TIMEDURATION_REQUEST_TASK[NewValue] = "In Progress"
                    ),
                TIMEDURATION_REQUEST_TASK[ChangedOnDateTime],ASC
    )))
VAR PreviousValue =
    MINX(PreviousRow,[ChangedOnDateTime])
RETURN PreviousValue&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; here a prt screen of an example of the data I have to work with:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Number&lt;/EM&gt; is the unique ticket the specific timestamps are referring to.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Hope someone has an answer &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 14 Jan 2024 17:37:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/how-to-get-date-value-from-another-row-in-the-same-table/m-p/3637684#M140765</guid>
      <dc:creator>maxnuij</dc:creator>
      <dc:date>2024-01-14T17:37:38Z</dc:date>
    </item>
    <item>
      <title>Re: how to get date value from another row in the same table?</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/how-to-get-date-value-from-another-row-in-the-same-table/m-p/3638071#M140799</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="674429" data-lia-user-login="maxnuij" class="lia-mention lia-mention-user"&gt;maxnuij&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;If I understand correctly, the issue is that you want to get value from another row. Please &lt;SPAN&gt;try the following methods and check if they can solve your problem:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;1.You can try to&amp;nbsp;limit the amount of data being processed through aggregation or filter.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;2.You need to rely on DAX calculations. Enter the following DAX formula.&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;PreviousDate =
VAR CurrentRow = SELECTEDVALUE(TIMEDURATION_REQUEST_TASK[ChangedOnDateTime])
VAR PreviousRow =
    FILTER(
        ALL(TIMEDURATION_REQUEST_TASK),
        TIMEDURATION_REQUEST_TASK[ChangedOnDateTime] &amp;lt; CurrentRow
            &amp;amp;&amp;amp; TIMEDURATION_REQUEST_TASK[NewValue] = "In Progress"
    )
VAR PreviousValue = MAXX(PreviousRow, TIMEDURATION_REQUEST_TASK[ChangedOnDateTime])
RETURN PreviousValue&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Wisdom Wu&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jan 2024 03:24:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/how-to-get-date-value-from-another-row-in-the-same-table/m-p/3638071#M140799</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-01-15T03:24:48Z</dc:date>
    </item>
  </channel>
</rss>

