<?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: Creating a measure in Dax to calculate difference between two rows (similar to excel) in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Creating-a-measure-in-Dax-to-calculate-difference-between-two/m-p/1665718#M34013</link>
    <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;BR /&gt;Try this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Diff = 
var _curMeasure = MAX(myTable[Measure]) //This row's measure
var _curTime = MAX(myTable[Time])       //This row's time


var _calc = CALCULATE(MAX(myTable[Measure]),FILTER(ALL(myTable),myTable[Time]&amp;lt;_curTime))  //Get the measure of the previous row


return IF(_curMeasure-_calc=_curMeasure,0,_curMeasure-_calc)  //if there is no previous measure, then 0 else the diff&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Let me know if you have any questions.&lt;BR /&gt;&lt;BR /&gt;If this solves your issues, please mark it as the &lt;STRONG&gt;solution, &lt;/STRONG&gt;so that others can find it easily. &lt;STRONG&gt;Kudos &lt;/STRONG&gt;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;are nice too.&lt;BR /&gt;Nathaniel&lt;/P&gt;</description>
    <pubDate>Mon, 15 Feb 2021 02:34:06 GMT</pubDate>
    <dc:creator>Nathaniel_C</dc:creator>
    <dc:date>2021-02-15T02:34:06Z</dc:date>
    <item>
      <title>Creating a measure in Dax to calculate difference between two rows (similar to excel)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Creating-a-measure-in-Dax-to-calculate-difference-between-two/m-p/1665524#M34009</link>
      <description>&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I would like to create a new column which would measure the difference between the two rows to find the "scan length"&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;What would be the DAX formula for this?&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2021 00:16:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Creating-a-measure-in-Dax-to-calculate-difference-between-two/m-p/1665524#M34009</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-02-15T00:16:19Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a measure in Dax to calculate difference between two rows (similar to excel)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Creating-a-measure-in-Dax-to-calculate-difference-between-two/m-p/1665718#M34013</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;BR /&gt;Try this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Diff = 
var _curMeasure = MAX(myTable[Measure]) //This row's measure
var _curTime = MAX(myTable[Time])       //This row's time


var _calc = CALCULATE(MAX(myTable[Measure]),FILTER(ALL(myTable),myTable[Time]&amp;lt;_curTime))  //Get the measure of the previous row


return IF(_curMeasure-_calc=_curMeasure,0,_curMeasure-_calc)  //if there is no previous measure, then 0 else the diff&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Let me know if you have any questions.&lt;BR /&gt;&lt;BR /&gt;If this solves your issues, please mark it as the &lt;STRONG&gt;solution, &lt;/STRONG&gt;so that others can find it easily. &lt;STRONG&gt;Kudos &lt;/STRONG&gt;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;are nice too.&lt;BR /&gt;Nathaniel&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2021 02:34:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Creating-a-measure-in-Dax-to-calculate-difference-between-two/m-p/1665718#M34013</guid>
      <dc:creator>Nathaniel_C</dc:creator>
      <dc:date>2021-02-15T02:34:06Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a measure in Dax to calculate difference between two rows (similar to excel)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Creating-a-measure-in-Dax-to-calculate-difference-between-two/m-p/1665900#M34015</link>
      <description>&lt;P&gt;I am unsure what to put for this rows measure?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2021 04:52:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Creating-a-measure-in-Dax-to-calculate-difference-between-two/m-p/1665900#M34015</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-02-15T04:52:58Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a measure in Dax to calculate difference between two rows (similar to excel)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Creating-a-measure-in-Dax-to-calculate-difference-between-two/m-p/1665925#M34016</link>
      <description>&lt;P&gt;new column=maxx(filter(table,table[Local Time]&amp;gt;earlier(table[Local Time])),table[Local Time])-table[Local Time]&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2021 05:11:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Creating-a-measure-in-Dax-to-calculate-difference-between-two/m-p/1665925#M34016</guid>
      <dc:creator>wdx223_Daniel</dc:creator>
      <dc:date>2021-02-15T05:11:14Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a measure in Dax to calculate difference between two rows (similar to excel)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Creating-a-measure-in-Dax-to-calculate-difference-between-two/m-p/1667330#M34048</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;BR /&gt;As you did not supply us with a pbix, I created a quick table called myTable with the columns named Time and Measure.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;img /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Let me know if you have any questions.&lt;BR /&gt;&lt;BR /&gt;If this solves your issues, please mark it as the &lt;STRONG&gt;solution, &lt;/STRONG&gt;so that others can find it easily. &lt;STRONG&gt;Kudos &lt;/STRONG&gt;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;are nice too.&lt;BR /&gt;Nathaniel&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Feb 2021 15:24:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Creating-a-measure-in-Dax-to-calculate-difference-between-two/m-p/1667330#M34048</guid>
      <dc:creator>Nathaniel_C</dc:creator>
      <dc:date>2021-02-15T15:24:06Z</dc:date>
    </item>
  </channel>
</rss>

