<?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: Calculating time-over-time change over irregular intervals in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-time-over-time-change-over-irregular-intervals/m-p/753100#M2877</link>
    <description>&lt;P&gt;OK. This should be done in PQ for sure. If the table is reasonably small, you could do this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;[Previous Date] = -- calculated column
var __currentDate = TSD[Date]
var __currentCat = TSD[Category]
var __prevDate =
	MAXX(
		FILTER(
			TSD,
			TSD[Date] &amp;lt; __currentDate
			&amp;amp;&amp;amp;
			TSD[Category] = __currentCat
		),
		TSD[Date]
	)
return
	__prevDate
	
[Previous Value] = -- calculated column
var __currentCat = TSD[Category]
var __prevDate = TSD[Previous Date] -- calculated column above
var __prevValue =
	MAXX(
		FILTER(
			TSD,
			TSD[Date] = __prevDate
			&amp;amp;&amp;amp;
			TSD[Category] = __currentCat
		),
		TSD[Value]
	)
return
	__prevValue&lt;/PRE&gt;&lt;P&gt;Now you're able to create another calculated column that will hold the difference in values. But you could also create only one calculated column telescoping the formulas into one...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best&lt;/P&gt;&lt;P&gt;Darek&lt;/P&gt;</description>
    <pubDate>Tue, 30 Jul 2019 18:12:03 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-07-30T18:12:03Z</dc:date>
    <item>
      <title>Calculating time-over-time change over irregular intervals</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-time-over-time-change-over-irregular-intervals/m-p/752985#M2863</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to calculate the delta of a value between dates that occur at non-regular intervals, grouped by category. A simplified example of the data is below.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I know there are quick measures for things like year-over-year, or year-over-month change, but I was struggling to adapt these. I did manage to create a calculated column with the previous date in each row grouping by category, and if I can extend this to determine the Value for that previous date, I can take the difference that way... I am open to other approaches as well.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thank you for your time - Alex&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;Previous Date = 
    CALCULATE(MAX(TimeSeriesData[Date]), FILTER(TimeSeriesData, EARLIER(TimeSeriesData[Date])&amp;gt;TimeSeriesData[Date] &amp;amp;&amp;amp; EARLIER([Category])=TimeSeriesData[Category]))&lt;/PRE&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 30 Jul 2019 15:40:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-time-over-time-change-over-irregular-intervals/m-p/752985#M2863</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-07-30T15:40:50Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating time-over-time change over irregular intervals</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-time-over-time-change-over-irregular-intervals/m-p/753026#M2870</link>
      <description>Why don't you do that in Power Query? This is where you should do it, to be honest.&lt;BR /&gt;&lt;BR /&gt;Best&lt;BR /&gt;Darek</description>
      <pubDate>Tue, 30 Jul 2019 16:47:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-time-over-time-change-over-irregular-intervals/m-p/753026#M2870</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-07-30T16:47:10Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating time-over-time change over irregular intervals</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-time-over-time-change-over-irregular-intervals/m-p/753053#M2873</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;, I am open to other approaches and would appreciate if you would explain your proposal. Thanks.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jul 2019 17:20:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-time-over-time-change-over-irregular-intervals/m-p/753053#M2873</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-07-30T17:20:18Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating time-over-time change over irregular intervals</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-time-over-time-change-over-irregular-intervals/m-p/753100#M2877</link>
      <description>&lt;P&gt;OK. This should be done in PQ for sure. If the table is reasonably small, you could do this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;[Previous Date] = -- calculated column
var __currentDate = TSD[Date]
var __currentCat = TSD[Category]
var __prevDate =
	MAXX(
		FILTER(
			TSD,
			TSD[Date] &amp;lt; __currentDate
			&amp;amp;&amp;amp;
			TSD[Category] = __currentCat
		),
		TSD[Date]
	)
return
	__prevDate
	
[Previous Value] = -- calculated column
var __currentCat = TSD[Category]
var __prevDate = TSD[Previous Date] -- calculated column above
var __prevValue =
	MAXX(
		FILTER(
			TSD,
			TSD[Date] = __prevDate
			&amp;amp;&amp;amp;
			TSD[Category] = __currentCat
		),
		TSD[Value]
	)
return
	__prevValue&lt;/PRE&gt;&lt;P&gt;Now you're able to create another calculated column that will hold the difference in values. But you could also create only one calculated column telescoping the formulas into one...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best&lt;/P&gt;&lt;P&gt;Darek&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jul 2019 18:12:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-time-over-time-change-over-irregular-intervals/m-p/753100#M2877</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-07-30T18:12:03Z</dc:date>
    </item>
  </channel>
</rss>

