<?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 Calculate duration between dates in different rows and filtered on a value in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-duration-between-dates-in-different-rows-and-filtered/m-p/2878802#M93097</link>
    <description>&lt;P&gt;I have searched and searched and can't seem to find the same scenario. I am trying to calulate the duration an item takes from one step to the next. My table looks like below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The "INC_ENTRY_ID" will appear multiple times if that specific record changes.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, in that data woudl be something like below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I need to do is calculate the duration from the earliest date to the next date and then the next date, and so on for each unique&amp;nbsp;"INC_ENTRY_ID" - the other columns will not be duplicated (they are either index or a different id series)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I should add that I will really be drilling into this from a summary view if a user wants to see more details. So, in a different report they would be clicking on a value for the first column. So, I don't need to view everything at once... it would be a filtered view of a value from the first column.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 02 Nov 2022 04:25:48 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-11-02T04:25:48Z</dc:date>
    <item>
      <title>Calculate duration between dates in different rows and filtered on a value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-duration-between-dates-in-different-rows-and-filtered/m-p/2878802#M93097</link>
      <description>&lt;P&gt;I have searched and searched and can't seem to find the same scenario. I am trying to calulate the duration an item takes from one step to the next. My table looks like below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The "INC_ENTRY_ID" will appear multiple times if that specific record changes.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, in that data woudl be something like below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I need to do is calculate the duration from the earliest date to the next date and then the next date, and so on for each unique&amp;nbsp;"INC_ENTRY_ID" - the other columns will not be duplicated (they are either index or a different id series)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I should add that I will really be drilling into this from a summary view if a user wants to see more details. So, in a different report they would be clicking on a value for the first column. So, I don't need to view everything at once... it would be a filtered view of a value from the first column.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2022 04:25:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-duration-between-dates-in-different-rows-and-filtered/m-p/2878802#M93097</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-11-02T04:25:48Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate duration between dates in different rows and filtered on a value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-duration-between-dates-in-different-rows-and-filtered/m-p/2878877#M93106</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt; , Based on what I got, a new column &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;New column =&lt;/P&gt;
&lt;P&gt;var _date&amp;nbsp; = maxx(filter(Table, [INC_ENTRY_ID] = earlier([INC_ENTRY_ID]) &amp;amp;&amp;amp; [Audit_date] &amp;lt; earlier([Audit_date]) ) , [Audit_date])&lt;/P&gt;
&lt;P&gt;return&lt;/P&gt;
&lt;P&gt;datediff(_date,[Audit_date], second)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or if you need time&lt;/P&gt;
&lt;P&gt;return&lt;/P&gt;
&lt;P&gt;[Audit_date] - _date&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Power BI DAX- Earlier, I should have known Earlier: &lt;A href="https://youtu.be/CVW6YwvHHi8" target="_blank"&gt;https://youtu.be/CVW6YwvHHi8&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2022 05:00:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-duration-between-dates-in-different-rows-and-filtered/m-p/2878877#M93106</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2022-11-02T05:00:51Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate duration between dates in different rows and filtered on a value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-duration-between-dates-in-different-rows-and-filtered/m-p/2881630#M93293</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="148838" data-lia-user-login="amitchandak" class="lia-mention lia-mention-user"&gt;amitchandak&lt;/a&gt;&amp;nbsp;- Thank you again. I did notice one problem that I have not been able to figure out. The formula does accurately calculate the duration; however, the duration does not appear on the correct row.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So - duration is calculating correctly but it should show up on the previous row. For example, in the screenshot below, the first row started with the group "General Triage" on 10/25/2002 at 7:20 AM. It was with that group for 1980 minutes before it went to the "Virtual Desktop" group who then had it for 881 minutes and so on. Any idea how to fix that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 02:15:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-duration-between-dates-in-different-rows-and-filtered/m-p/2881630#M93293</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-11-03T02:15:56Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate duration between dates in different rows and filtered on a value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-duration-between-dates-in-different-rows-and-filtered/m-p/2896999#M94231</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please try following DAX:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Column = 
var _date = MINX(FILTER('Table','Table'[INC_ENTRY_ID] = EARLIER('Table'[INC_ENTRY_ID]) &amp;amp;&amp;amp; 'Table'[AUDIT_DATE] &amp;gt; EARLIER('Table'[AUDIT_DATE])),'Table'[AUDIT_DATE])
return
DATEDIFF([AUDIT_DATE],_date,MINUTE)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The result you want:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;Yadong Fang&lt;/P&gt;
&lt;P&gt;If this post&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Nov 2022 08:27:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-duration-between-dates-in-different-rows-and-filtered/m-p/2896999#M94231</guid>
      <dc:creator>v-yadongf-msft</dc:creator>
      <dc:date>2022-11-10T08:27:41Z</dc:date>
    </item>
  </channel>
</rss>

