<?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 difference between values in different columns in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-difference-between-values-in-different-columns/m-p/875331#M7330</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to build the Excel visualization (see screenshot) in PBI. I assume this is possible with a DAX measure? I've been playing around with some DAX functions and tried some solutions from previous posts, but I cannot get my head around it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It basically needs to calculate the difference in Amount compared to the Amount of the previous date. It should be dynamic; new dates can get added to the table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any hints, tips are appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&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;Armand&lt;/P&gt;</description>
    <pubDate>Sat, 14 Dec 2019 13:35:39 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-12-14T13:35:39Z</dc:date>
    <item>
      <title>Calculate difference between values in different columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-difference-between-values-in-different-columns/m-p/875331#M7330</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to build the Excel visualization (see screenshot) in PBI. I assume this is possible with a DAX measure? I've been playing around with some DAX functions and tried some solutions from previous posts, but I cannot get my head around it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It basically needs to calculate the difference in Amount compared to the Amount of the previous date. It should be dynamic; new dates can get added to the table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any hints, tips are appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&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;Armand&lt;/P&gt;</description>
      <pubDate>Sat, 14 Dec 2019 13:35:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-difference-between-values-in-different-columns/m-p/875331#M7330</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-12-14T13:35:39Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate difference between values in different columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-difference-between-values-in-different-columns/m-p/875435#M7333</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;try a measure&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;diff = SELECTEDVALUE('Table'[Amount])-calculate(FIRSTNONBLANK('Table'[Amount];1);filter(ALLEXCEPT('Table';'Table'[Article]);'Table'[Date]&amp;lt;selectedvalue('Table'[Date])))&lt;/LI-CODE&gt;&lt;P&gt;&lt;STRONG&gt;&lt;I&gt;&lt;FONT color="#ababab"&gt;do not hesitate to give a kudo to useful posts and mark solutions as solution&lt;/FONT&gt;&lt;/I&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 14 Dec 2019 21:09:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-difference-between-values-in-different-columns/m-p/875435#M7333</guid>
      <dc:creator>az38</dc:creator>
      <dc:date>2019-12-14T21:09:26Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate difference between values in different columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-difference-between-values-in-different-columns/m-p/876307#M7361</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="82403" data-lia-user-login="az38" class="lia-mention lia-mention-user"&gt;az38&lt;/a&gt;&amp;nbsp;thank you for your proposal, but unfortunately it did not work out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Eventually I found the solution using the following measures:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;PreviousDate&lt;/LI&gt;&lt;LI&gt;Amount previous date&lt;/LI&gt;&lt;LI&gt;Diff with prev date&lt;/LI&gt;&lt;LI&gt;Diff %&lt;/LI&gt;&lt;/OL&gt;&lt;LI-CODE lang="markup"&gt;PreviousDate = 
    VAR CurrentDate =
        SELECTEDVALUE ( 'Sheet1'[Date] )
    RETURN
        CALCULATE (
            MAX ( 'Sheet1'[Date] );
            ALLSELECTED ( Sheet1 );
            KEEPFILTERS ( Sheet1[Date] &amp;lt; CurrentDate )
        )&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Amount previous date = 
VAR Prev = [PreviousDate]
RETURN
CALCULATE (
        [Total Amount];
        Sheet1[Date] = Prev
    )&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Diff with previous = 
[Total Amount] - [Amount previous date]&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Diff % = 
    IF (
        ISBLANK ( [Diff with previous] );
        BLANK ();
        DIVIDE ( [Diff with previous]; [Amount previous date] ) * 100
    )&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 16 Dec 2019 12:17:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-difference-between-values-in-different-columns/m-p/876307#M7361</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-12-16T12:17:16Z</dc:date>
    </item>
  </channel>
</rss>

