<?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 to Previous Row related to the Date in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Difference-to-Previous-Row-related-to-the-Date/m-p/4239399#M167751</link>
    <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;, thank you so much for your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have applied the formula you have suggested for the column Increase, but it did &lt;EM&gt;&lt;STRONG&gt;not work&lt;/STRONG&gt; &lt;/EM&gt;(please refer to the picture attaches). Could you please help me?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;-Here is the doc:&lt;/STRONG&gt;&lt;A href="https://docs.google.com/spreadsheets/d/1EYK1SrxCGfu4QEduPSEm3mfUr9ciTuYm/edit?usp=sharing&amp;amp;ouid=114221063275347234544&amp;amp;rtpof=true&amp;amp;sd=true" target="_self"&gt; Test File&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;- Here is the formula applied:&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;VAR _currentDate =MAX (InputDB[Close_Date])

VAR _previousDate =CALCULATE (
        MAX (InputDB[Close_Date]),
        FILTER (ALL(InputDB), InputDB[Close_Date] &amp;lt; _currentDate )
        )
        
RETURN


CALCULATE (
        [Total Representatives Needed],
        FILTER (ALL(InputDB), InputDB[Close_Date] = _previousDate )
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;- Here is the Image:&lt;/STRONG&gt; The Increase Column should be equal to the shifted &lt;STRONG&gt;Total Representatives Needed&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;** Note: I am having some problems with the&amp;nbsp;Total Representatives Needed&amp;nbsp;column as well. I have asked for help in&lt;A href="https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Progression-Sum-with-existing-and-non-existing-dates/m-p/4238884#M167717" target="_self"&gt; Here&lt;/A&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 12 Oct 2024 00:38:37 GMT</pubDate>
    <dc:creator>Andiko</dc:creator>
    <dc:date>2024-10-12T00:38:37Z</dc:date>
    <item>
      <title>Difference to Previous Row related to the Date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Difference-to-Previous-Row-related-to-the-Date/m-p/4237557#M167623</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a Meassure called&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;[Increase]&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;which I need it to:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Calculate the difference from previous Row for the Column&amp;nbsp;&lt;STRONG&gt;[Total Representatives Needed]&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;**&amp;nbsp;&lt;SPAN class=""&gt;This should be calculated for the Dates that exist in the&amp;nbsp;InputDB&amp;nbsp;ONLY. This entries are reflected in the&amp;nbsp;[Cumulative Recurring Revenue]&amp;nbsp;column&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;I have constructed this using the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;formula below:&amp;nbsp;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;=[Total Representatives Needed] -

CALCULATE(
	[Total Representatives Needed],
	
		FILTER(
		all('Calendar'),
		'Calendar'[Date] &amp;lt;= max(InputDB[Close_Date])
	),
	
	TOPN(1, 'Calendar','Calendar'[Date],DESC)
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, as you can see in the image below, it is &lt;STRONG&gt;not working&lt;/STRONG&gt; since the &lt;STRONG&gt;values are incorrect &lt;/STRONG&gt;&lt;EM&gt;(&lt;/EM&gt;&lt;EM&gt;the value highlited with Orange is the expected value)&lt;/EM&gt; and&amp;nbsp;&lt;SPAN&gt;it is giving me values for&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;all the dates&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;from the&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Calendar Table&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;(even if they do not exist in the&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;InputDB&lt;/STRONG&gt;&lt;SPAN&gt;).&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried many options using the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;EDATE function, SUMX, SUM,&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Etc. But, either the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;values are incorrect,&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;or does not solve the problem with the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;dates.&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Nothing seems to work. Thus, I would like to get your help please!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am attaching the file I am using here: &lt;A href="https://docs.google.com/spreadsheets/d/1IC_G63gZypjjecZlPpevye0sOcMJodwI/edit?usp=sharing&amp;amp;ouid=114221063275347234544&amp;amp;rtpof=true&amp;amp;sd=true" target="_self"&gt;Test-File 3&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Oct 2024 19:38:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Difference-to-Previous-Row-related-to-the-Date/m-p/4237557#M167623</guid>
      <dc:creator>Andiko</dc:creator>
      <dc:date>2024-10-10T19:38:36Z</dc:date>
    </item>
    <item>
      <title>Re: Difference to Previous Row related to the Date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Difference-to-Previous-Row-related-to-the-Date/m-p/4237910#M167648</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="822924" data-lia-user-login="Andiko" class="lia-mention lia-mention-user"&gt;Andiko&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Given&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;I&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;don't&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;know&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;how&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;you&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;create&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;your&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;matrix,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;I'll&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;share&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;a&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;sample&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;set&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;as&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;a&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;reference.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Then add a measure:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Previous =
VAR _currentDate =
    MAX ( 'Table'[Date] )
VAR _previousDate =
    CALCULATE (
        MAX ( 'Table'[Date] ),
        FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Date] &amp;lt; _currentDate )
    )
RETURN
    CALCULATE (
        [Measure],
        FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Date] = _previousDate )
    )
&lt;/LI-CODE&gt;
&lt;P&gt;The result is as follow:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;If the above one can't help you, please share your .pbix file(exclude sensitive data), so that we can help you better.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;
&lt;P&gt;Zhengdong Xu&lt;BR /&gt;If this post&amp;nbsp;&lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&lt;EM&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Oct 2024 02:30:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Difference-to-Previous-Row-related-to-the-Date/m-p/4237910#M167648</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-10-11T02:30:10Z</dc:date>
    </item>
    <item>
      <title>Re: Difference to Previous Row related to the Date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Difference-to-Previous-Row-related-to-the-Date/m-p/4239211#M167725</link>
      <description>&lt;P&gt;&lt;SPAN&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="736379" data-lia-user-login="shafiz_p" class="lia-mention lia-mention-user"&gt;shafiz_p&lt;/a&gt;,&amp;nbsp;do you think you can take a look please?&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":folded_hands:"&gt;🙏&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Oct 2024 18:05:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Difference-to-Previous-Row-related-to-the-Date/m-p/4239211#M167725</guid>
      <dc:creator>Andiko</dc:creator>
      <dc:date>2024-10-11T18:05:33Z</dc:date>
    </item>
    <item>
      <title>Re: Difference to Previous Row related to the Date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Difference-to-Previous-Row-related-to-the-Date/m-p/4239399#M167751</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;, thank you so much for your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have applied the formula you have suggested for the column Increase, but it did &lt;EM&gt;&lt;STRONG&gt;not work&lt;/STRONG&gt; &lt;/EM&gt;(please refer to the picture attaches). Could you please help me?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;-Here is the doc:&lt;/STRONG&gt;&lt;A href="https://docs.google.com/spreadsheets/d/1EYK1SrxCGfu4QEduPSEm3mfUr9ciTuYm/edit?usp=sharing&amp;amp;ouid=114221063275347234544&amp;amp;rtpof=true&amp;amp;sd=true" target="_self"&gt; Test File&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;- Here is the formula applied:&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;VAR _currentDate =MAX (InputDB[Close_Date])

VAR _previousDate =CALCULATE (
        MAX (InputDB[Close_Date]),
        FILTER (ALL(InputDB), InputDB[Close_Date] &amp;lt; _currentDate )
        )
        
RETURN


CALCULATE (
        [Total Representatives Needed],
        FILTER (ALL(InputDB), InputDB[Close_Date] = _previousDate )
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;- Here is the Image:&lt;/STRONG&gt; The Increase Column should be equal to the shifted &lt;STRONG&gt;Total Representatives Needed&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;** Note: I am having some problems with the&amp;nbsp;Total Representatives Needed&amp;nbsp;column as well. I have asked for help in&lt;A href="https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Progression-Sum-with-existing-and-non-existing-dates/m-p/4238884#M167717" target="_self"&gt; Here&lt;/A&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 12 Oct 2024 00:38:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Difference-to-Previous-Row-related-to-the-Date/m-p/4239399#M167751</guid>
      <dc:creator>Andiko</dc:creator>
      <dc:date>2024-10-12T00:38:37Z</dc:date>
    </item>
    <item>
      <title>Re: Difference to Previous Row related to the Date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Difference-to-Previous-Row-related-to-the-Date/m-p/4239746#M167781</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="736379" data-lia-user-login="shafiz_p" class="lia-mention lia-mention-user"&gt;shafiz_p&lt;/a&gt;, I was able to create the formula below that is giving me the difference to previous row and I named&lt;STRONG&gt; increase.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;VAR CurrentDate = MAX(InputDB[Close_Date])

VAR PreviousDate = CALCULATE(
	MAX(InputDB[Close_Date]),
	
	FILTER(
		ALL('Calendar'),
		'Calendar'[Date] &amp;lt; CurrentDate
		)
	)

VAR CurrentValue =[Total Representatives Needed]

VAR PreviousValue =CALCULATE(
	
	[Total Representatives Needed],
	'Calendar'[Date] = PreviousDate
	)

RETURN

IF( ISBLANK(PreviousValue), BLANK(), CurrentValue - PreviousValue)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, it works &lt;EM&gt;&lt;STRONG&gt;only&lt;/STRONG&gt; &lt;/EM&gt;with the entries that have the &lt;STRONG&gt;Close_date.&lt;/STRONG&gt; But, due to the nature of the calculations needed, the column &lt;STRONG&gt;Total Representatives Needed&lt;/STRONG&gt; also has data for the same dates of the &lt;STRONG&gt;Close_date but shifted 1 year in the future. &lt;/STRONG&gt;The shifting of those dates&amp;nbsp;made by following this &lt;A href="https://community.fabric.microsoft.com/t5/Power-Query/Problem-with-DateADD-Running-Totals-and-Dates/m-p/4236367#M139772" target="_self"&gt;thread.&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now, the problems are:&lt;/P&gt;&lt;P&gt;1. I am unable to find a way to make the Increase formula to work for &lt;STRONG&gt;all the dates listed.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;** As you can see in the first image, everything works perfectly until there is data for the entries with the &lt;STRONG&gt;Close_date shifted.&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. The &lt;STRONG&gt;agregation&lt;/STRONG&gt; does &lt;STRONG&gt;not&lt;/STRONG&gt; seem to work&lt;/P&gt;&lt;P&gt;&lt;EM&gt;** ** As you can see in the second image, the values are correct when the table is expanded and all the dates are shown, but when the table is comprised, then the numbers make no sense.&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Could you guys help me please?&lt;span class="lia-unicode-emoji" title=":folded_hands:"&gt;🙏&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am attaching the file I am using here: &lt;A href="https://docs.google.com/spreadsheets/d/1UqUFl6pnbSMoo3X0lZ-DtWbh0Y1L38Dz/edit?usp=sharing&amp;amp;ouid=114221063275347234544&amp;amp;rtpof=true&amp;amp;sd=true" target="_self"&gt;Test File 3.4&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 12 Oct 2024 21:51:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Difference-to-Previous-Row-related-to-the-Date/m-p/4239746#M167781</guid>
      <dc:creator>Andiko</dc:creator>
      <dc:date>2024-10-12T21:51:02Z</dc:date>
    </item>
    <item>
      <title>Re: Difference to Previous Row related to the Date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Difference-to-Previous-Row-related-to-the-Date/m-p/4243118#M167992</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/736379" target="_blank"&gt;@shafiz_p&lt;/A&gt;&lt;SPAN&gt;, can you please help me with this?&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":folded_hands:"&gt;🙏&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have tried so many things and nothing seem to work. Thus, I would highly appreciate your help!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Oct 2024 13:12:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Difference-to-Previous-Row-related-to-the-Date/m-p/4243118#M167992</guid>
      <dc:creator>Andiko</dc:creator>
      <dc:date>2024-10-15T13:12:35Z</dc:date>
    </item>
  </channel>
</rss>

