<?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 Substracting values in same columns based on date column in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Substracting-values-in-same-columns-based-on-date-column/m-p/828393#M5887</link>
    <description>&lt;P&gt;Hi everybody, I hope I could get a little help here.&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I need a help to create following calculated column and that is "compared" in my sample table. We generate new dates for actual and planned finish once a month - hence the reporting date. For each reporting month, the dates for actual and planned finish might differ, as is shown in the table. In my date diff column I am calculating actual finish - planned finish. The "date difference previous reporting month" column is the same, just accounting for dates recorded previosu reporting month - actual finish -1 and planned finish -1. Now my question comes: I need to compare those two date differences to show if we have worsen in following the deadlines or on the other hand if we improved. therefore I need to substract "date diff" minus "date difference previous reporting month". What I did I thought is correct was to merge these two differences in one columns, as I thought it would be easier to substract them like this. But I have been only capable of making calculation to substract the smallest value from the biggest value:&lt;BR /&gt;Change days column =&lt;BR /&gt;var min_value = CALCULATE(MIN(table[merged date difference]); ALLEXCEPT(table; table[product])&lt;BR /&gt;var max_value = CALCULATE(MAX(table[merged date difference]); ALLEXCEPT(table; table[product])&lt;BR /&gt;return&lt;BR /&gt;min_value - max_value&lt;/P&gt;&lt;P&gt;But it is not always the case that "date diff" is the smalles, as for example in the last product. I always need to substract date diff - datw difference previous reporting month.&lt;BR /&gt;Can comebody help me, I got a bit stuck.&lt;/P&gt;</description>
    <pubDate>Fri, 25 Oct 2019 08:37:50 GMT</pubDate>
    <dc:creator>AU555</dc:creator>
    <dc:date>2019-10-25T08:37:50Z</dc:date>
    <item>
      <title>Substracting values in same columns based on date column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Substracting-values-in-same-columns-based-on-date-column/m-p/828393#M5887</link>
      <description>&lt;P&gt;Hi everybody, I hope I could get a little help here.&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I need a help to create following calculated column and that is "compared" in my sample table. We generate new dates for actual and planned finish once a month - hence the reporting date. For each reporting month, the dates for actual and planned finish might differ, as is shown in the table. In my date diff column I am calculating actual finish - planned finish. The "date difference previous reporting month" column is the same, just accounting for dates recorded previosu reporting month - actual finish -1 and planned finish -1. Now my question comes: I need to compare those two date differences to show if we have worsen in following the deadlines or on the other hand if we improved. therefore I need to substract "date diff" minus "date difference previous reporting month". What I did I thought is correct was to merge these two differences in one columns, as I thought it would be easier to substract them like this. But I have been only capable of making calculation to substract the smallest value from the biggest value:&lt;BR /&gt;Change days column =&lt;BR /&gt;var min_value = CALCULATE(MIN(table[merged date difference]); ALLEXCEPT(table; table[product])&lt;BR /&gt;var max_value = CALCULATE(MAX(table[merged date difference]); ALLEXCEPT(table; table[product])&lt;BR /&gt;return&lt;BR /&gt;min_value - max_value&lt;/P&gt;&lt;P&gt;But it is not always the case that "date diff" is the smalles, as for example in the last product. I always need to substract date diff - datw difference previous reporting month.&lt;BR /&gt;Can comebody help me, I got a bit stuck.&lt;/P&gt;</description>
      <pubDate>Fri, 25 Oct 2019 08:37:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Substracting-values-in-same-columns-based-on-date-column/m-p/828393#M5887</guid>
      <dc:creator>AU555</dc:creator>
      <dc:date>2019-10-25T08:37:50Z</dc:date>
    </item>
    <item>
      <title>Re: Substracting values in same columns based on date column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Substracting-values-in-same-columns-based-on-date-column/m-p/828453#M5888</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="176914" data-lia-user-login="AU555" class="lia-mention lia-mention-user"&gt;AU555&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;PRE&gt;Column =
VAR PrevDate = CALCULATE(MAX(Test[ReportingDate]),FILTER(ALL(Test[ReportingDate]),Test[ReportingDate]&amp;lt;MAX(Test[ReportingDate])),ALLEXCEPT(Test,Test[Product]))
VAR PrevValue = CALCULATE(SUM(Test[PrevDateDiff]),Test[ReportingDate]=PrevDate,ALLEXCEPT(Test,Test[Product]))
RETURN CALCULATE(SUM(Test[DateDiff])-PrevValue,ALLEXCEPT(Test,Test[Product]))&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 25 Oct 2019 09:03:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Substracting-values-in-same-columns-based-on-date-column/m-p/828453#M5888</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-10-25T09:03:44Z</dc:date>
    </item>
    <item>
      <title>Re: Substracting values in same columns based on date column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Substracting-values-in-same-columns-based-on-date-column/m-p/829368#M5951</link>
      <description>&lt;P&gt;Than you so much, works just as i wanted to! :)&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 27 Oct 2019 17:10:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Substracting-values-in-same-columns-based-on-date-column/m-p/829368#M5951</guid>
      <dc:creator>AU555</dc:creator>
      <dc:date>2019-10-27T17:10:32Z</dc:date>
    </item>
  </channel>
</rss>

