<?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: Difference between last row in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Difference-between-last-row/m-p/3350486#M125804</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="518952" data-lia-user-login="barritown" class="lia-mention lia-mention-user"&gt;barritown&lt;/a&gt;, thanks a lot for your help.&lt;BR /&gt;Your purpose doesn't work because COUNT(ID) is a calculated measure already (Measure COUNT(ID) = Count(products[ID])&lt;BR /&gt;I've tried to set a column for this count but it doesn't work too.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;AMeasure Difference = 
VAR CurrentCount = MAX(COUNT(products[id]))
VAR CurrentDate = MAX(products[date]) 
VAR PreviousDate = MAXX(FILTER(ALL(products), [date] &amp;lt; CurrentDate ),[date]) 
VAR PreviousCount = MAXX(FILTER(ALL(products), [date] = PreviousDate ), (COUNT(products[id]))) 
RETURN IF(ISBLANK(PreviousCount), BLANK(), CurrentCount - PreviousCount)&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN class=""&gt;Error : The MAX function in DAX only accepts a column reference as an argument&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 26 Jul 2023 08:31:13 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-07-26T08:31:13Z</dc:date>
    <item>
      <title>Difference between last row</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Difference-between-last-row/m-p/3334344#M125034</link>
      <description>&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;COUNT(ID)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01/01/2023&lt;/TD&gt;&lt;TD&gt;15000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;05/02/2023&lt;/TD&gt;&lt;TD&gt;15100&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;07/02/2023&lt;/TD&gt;&lt;TD&gt;15030&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;08/02/2023&lt;/TD&gt;&lt;TD&gt;18000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;17/03/2023&lt;/TD&gt;&lt;TD&gt;14500&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;Hello there,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I use direct query, how can I calculate change between days without any logical chronology between each day?&lt;BR /&gt;I just want to calculate the change with the previous row.&lt;BR /&gt;&lt;BR /&gt;Thanks in advance,&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jul 2023 12:36:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Difference-between-last-row/m-p/3334344#M125034</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-07-17T12:36:26Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between last row</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Difference-between-last-row/m-p/3334692#M125046</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;If entries in your table are sorted by date and there are no duplicate dates, you could try such a measure:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;In plain text for convenience:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Difference Measure = 
VAR CurrentCount = MAX ( [COUNT(ID)] )
VAR CurrentDate = MAX ( [Date] )
VAR PreviousDate = MAXX ( FILTER ( ALL ( data ), [Date] &amp;lt; CurrentDate ), [Date] )
VAR PreviousCount = MAXX ( FILTER ( ALL ( data ), [Date] = PreviousDate ), [COUNT(ID)] )
RETURN IF ( ISBLANK ( PreviousCount ), BLANK(), CurrentCount - PreviousCount )&lt;/LI-CODE&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="2"&gt;Best Regards, &lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="2"&gt;Alexander&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="2"&gt;&lt;A href="https://youtube.com/@powerbi-vlog" target="_blank"&gt;My YouTube vlog in English&lt;/A&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="2"&gt;&lt;A href="https://youtube.com/@pbi-vlog" target="_blank"&gt;My YouTube vlog in Russian&lt;/A&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jul 2023 15:20:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Difference-between-last-row/m-p/3334692#M125046</guid>
      <dc:creator>barritown</dc:creator>
      <dc:date>2023-07-17T15:20:56Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between last row</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Difference-between-last-row/m-p/3350486#M125804</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="518952" data-lia-user-login="barritown" class="lia-mention lia-mention-user"&gt;barritown&lt;/a&gt;, thanks a lot for your help.&lt;BR /&gt;Your purpose doesn't work because COUNT(ID) is a calculated measure already (Measure COUNT(ID) = Count(products[ID])&lt;BR /&gt;I've tried to set a column for this count but it doesn't work too.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;AMeasure Difference = 
VAR CurrentCount = MAX(COUNT(products[id]))
VAR CurrentDate = MAX(products[date]) 
VAR PreviousDate = MAXX(FILTER(ALL(products), [date] &amp;lt; CurrentDate ),[date]) 
VAR PreviousCount = MAXX(FILTER(ALL(products), [date] = PreviousDate ), (COUNT(products[id]))) 
RETURN IF(ISBLANK(PreviousCount), BLANK(), CurrentCount - PreviousCount)&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN class=""&gt;Error : The MAX function in DAX only accepts a column reference as an argument&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jul 2023 08:31:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Difference-between-last-row/m-p/3350486#M125804</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-07-26T08:31:13Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between last row</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Difference-between-last-row/m-p/3350558#M125808</link>
      <description>&lt;P&gt;Hello&amp;nbsp;Anonymous&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;For me it's difficult to take another try w/o access to your data model. If you can create a PBIX containing it and some toy data and share it with me, I'll be able to try to adapt my solution for your model.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jul 2023 09:00:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Difference-between-last-row/m-p/3350558#M125808</guid>
      <dc:creator>barritown</dc:creator>
      <dc:date>2023-07-26T09:00:23Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between last row</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Difference-between-last-row/m-p/3350561#M125809</link>
      <description>&lt;P&gt;Thanks a lot for your help&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="518952" data-lia-user-login="barritown" class="lia-mention lia-mention-user"&gt;barritown&lt;/a&gt;. I found the right code :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;AMeasure Difference =
VAR CurrentCount = CALCULATE(COUNT(products[id]))
VAR CurrentDate = LASTDATE(products[date])
VAR PreviousDate = MAXX(FILTER(ALL(products), products[date] &amp;lt; CurrentDate ), products[date])
VAR PreviousCount = CALCULATE(COUNT(products[id]), FILTER(ALL(products), products[date] = PreviousDate))
RETURN IF(ISBLANK(PreviousCount), BLANK(), CurrentCount - PreviousCount)&lt;/LI-CODE&gt;&lt;P&gt;This looks like OK for me &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jul 2023 09:02:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Difference-between-last-row/m-p/3350561#M125809</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-07-26T09:02:11Z</dc:date>
    </item>
  </channel>
</rss>

