<?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 Difference between two rows in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Difference-between-two-rows/m-p/2563440#M72992</link>
    <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;I have a table that looks like this (Please note that my date is in the format DD/MM/YYYY):&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I want to calculate the difference between two following dates where condition=1.&lt;BR /&gt;I managed to create the column in orange with the following DAX code:&lt;BR /&gt;datediff = IF( Table[condition]=1, Table[date] - CALCULATE( SUM(Table[date]), FILTER( Table[index] = EARLIER(Table[index])-1 ) ), BLANK() )&lt;BR /&gt;But I want to get the values in the yellow column. Can you help me achieve this without having to create a new index column?&lt;BR /&gt;Thank you&lt;/P&gt;</description>
    <pubDate>Tue, 07 Jun 2022 09:20:53 GMT</pubDate>
    <dc:creator>Unknown</dc:creator>
    <dc:date>2022-06-07T09:20:53Z</dc:date>
    <item>
      <title>Difference between two rows</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Difference-between-two-rows/m-p/2563440#M72992</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;I have a table that looks like this (Please note that my date is in the format DD/MM/YYYY):&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I want to calculate the difference between two following dates where condition=1.&lt;BR /&gt;I managed to create the column in orange with the following DAX code:&lt;BR /&gt;datediff = IF( Table[condition]=1, Table[date] - CALCULATE( SUM(Table[date]), FILTER( Table[index] = EARLIER(Table[index])-1 ) ), BLANK() )&lt;BR /&gt;But I want to get the values in the yellow column. Can you help me achieve this without having to create a new index column?&lt;BR /&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jun 2022 09:20:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Difference-between-two-rows/m-p/2563440#M72992</guid>
      <dc:creator>Unknown</dc:creator>
      <dc:date>2022-06-07T09:20:53Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between two rows</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Difference-between-two-rows/m-p/2563636#M73001</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="372198" data-lia-user-login="Unknown" class="lia-mention lia-mention-user"&gt;Unknown&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;You can use&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;datediff =
VAR CurrentDate = 'Table'[date]
VAR PreviousTable =
    FILTER (
        'Table',
        'Table'[date] &amp;lt; CurrentDate
            &amp;amp;&amp;amp; 'Table'[condition] &amp;lt;&amp;gt; BLANK ()
    )
VAR PreviousDate =
    MAXX ( PreviousTable, 'Table'[date] )
RETURN
    IF (
        'Table'[condition] = 1
            &amp;amp;&amp;amp; NOT ISEMPTY ( PreviousTable ),
        DATEDIFF ( PreviousDate, CurrentDate, DAY )
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jun 2022 10:43:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Difference-between-two-rows/m-p/2563636#M73001</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-06-07T10:43:16Z</dc:date>
    </item>
  </channel>
</rss>

