<?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: Calculate Difference between LASTDATE and 2nd to last date in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Difference-between-LASTDATE-and-2nd-to-last-date/m-p/817774#M5488</link>
    <description>&lt;P&gt;Great job!!! It works perfectly.&lt;/P&gt;</description>
    <pubDate>Tue, 15 Oct 2019 00:27:12 GMT</pubDate>
    <dc:creator>mwc</dc:creator>
    <dc:date>2019-10-15T00:27:12Z</dc:date>
    <item>
      <title>Calculate Difference between LASTDATE and 2nd to last date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Difference-between-LASTDATE-and-2nd-to-last-date/m-p/817664#M5484</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am looking to calculate the difference of the SUM of values between the LASTDATE rows, and the rows from the&amp;nbsp;2nd most recent date&amp;nbsp;(note that the dataset dates do not consist of consecutive days).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The calculation I have for SUM Last Date is working:&lt;/STRONG&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SUM Last Date = CALCULATE(SUM(Sheet1[NET_OPEN]),LASTDATE('Sheet1'[Date]))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;&lt;SPAN&gt;The calculation I have for generating the second to last date is working:&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;2nd Last Date = FORMAT(CALCULATE(MAX(Sheet1[Date]),FILTER(Sheet1, 'Sheet1'[Date]&amp;lt;&amp;gt;MAX(Sheet1[Date]))),"MM/DD/YYYY")&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;EM&gt;- just as a side note, I formatted the date figure&amp;nbsp;it to make sure the date format matched the date format in the table&amp;nbsp; that I want to filter.&amp;nbsp;&lt;/EM&gt; &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;&lt;SPAN&gt;The formula that is not working is the SUM of 2nd last date:&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SUM 2ND LAST DATE = CALCULATE(SUM(Sheet1[NET_OPEN]),FILTER(Sheet1,(Sheet1[2nd Last Date])))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;img /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 14 Oct 2019 21:11:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Difference-between-LASTDATE-and-2nd-to-last-date/m-p/817664#M5484</guid>
      <dc:creator>mwc</dc:creator>
      <dc:date>2019-10-14T21:11:47Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Difference between LASTDATE and 2nd to last date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Difference-between-LASTDATE-and-2nd-to-last-date/m-p/817716#M5487</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="166842" data-lia-user-login="mwc" class="lia-mention lia-mention-user"&gt;mwc&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First, don't convert the date to text, lose the FORMAT(). I'm assuming your date column is of Date type of course:&lt;/P&gt;
&lt;PRE&gt;2nd Last Date V2 =
CALCULATE (
    MAX ( Sheet1[Date] ),
    FILTER ( Sheet1, 'Sheet1'[Date] &amp;lt;&amp;gt; MAX ( Sheet1[Date] ) )
)&lt;/PRE&gt;
&lt;P&gt;and then:&lt;/P&gt;
&lt;PRE&gt;SUM 2ND LAST DATE =
VAR SecondLast_ = [2nd Last Date V2] // Your measure V2. Best practice is  to not use table name with measures
RETURN
    CALCULATE ( SUM ( Sheet1[NET_OPEN] ), Sheet1[Date] = SecondLast_ )
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Please mark the question solved when done and consider giving kudos if posts are helpful.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Cheers&amp;nbsp;&amp;nbsp;&lt;IMG src="https://community.fabric.microsoft.com/html/badge_icons/SU18_powerbi_badge.png" alt="Datanaut" width="64" height="64" border="0" /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Oct 2019 22:31:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Difference-between-LASTDATE-and-2nd-to-last-date/m-p/817716#M5487</guid>
      <dc:creator>AlB</dc:creator>
      <dc:date>2019-10-14T22:31:30Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Difference between LASTDATE and 2nd to last date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Difference-between-LASTDATE-and-2nd-to-last-date/m-p/817774#M5488</link>
      <description>&lt;P&gt;Great job!!! It works perfectly.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Oct 2019 00:27:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Difference-between-LASTDATE-and-2nd-to-last-date/m-p/817774#M5488</guid>
      <dc:creator>mwc</dc:creator>
      <dc:date>2019-10-15T00:27:12Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Difference between LASTDATE and 2nd to last date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Difference-between-LASTDATE-and-2nd-to-last-date/m-p/962289#M11287</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="92178" data-lia-user-login="AlB" class="lia-mention lia-mention-user"&gt;AlB&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your formula seems to be working for my file , but when i put in my matrix the columns it is showing only the Last month amount.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If i reamove the split by year it shows the sum of the multiple years and the delta as last to .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;IS there a way around it ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Alex&lt;/P&gt;</description>
      <pubDate>Fri, 06 Mar 2020 13:39:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Difference-between-LASTDATE-and-2nd-to-last-date/m-p/962289#M11287</guid>
      <dc:creator>alexbalazsalex</dc:creator>
      <dc:date>2020-03-06T13:39:54Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Difference between LASTDATE and 2nd to last date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Difference-between-LASTDATE-and-2nd-to-last-date/m-p/963474#M11381</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="50611" data-lia-user-login="alexbalazsalex" class="lia-mention lia-mention-user"&gt;alexbalazsalex&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not sure I understand the question. Can you show an example to illustrate the problem (ideally on a .pbix)?&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Please mark the question solved when done and consider &lt;FONT color="#FF9900"&gt;giving kudos &lt;/FONT&gt;if posts are helpful.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers&amp;nbsp;&amp;nbsp;&lt;IMG src="https://community.fabric.microsoft.com/html/badge_icons/SU18_powerbi_badge.png" border="0" alt="Datanaut" width="64" height="64" /&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 08 Mar 2020 13:18:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Difference-between-LASTDATE-and-2nd-to-last-date/m-p/963474#M11381</guid>
      <dc:creator>AlB</dc:creator>
      <dc:date>2020-03-08T13:18:29Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Difference between LASTDATE and 2nd to last date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Difference-between-LASTDATE-and-2nd-to-last-date/m-p/1670370#M34146</link>
      <description>&lt;P&gt;Hi guys, if i want to do the same but with the third and fourth date what can i do?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2021 23:49:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Difference-between-LASTDATE-and-2nd-to-last-date/m-p/1670370#M34146</guid>
      <dc:creator>lfdominguez10</dc:creator>
      <dc:date>2021-02-16T23:49:19Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Difference between LASTDATE and 2nd to last date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Difference-between-LASTDATE-and-2nd-to-last-date/m-p/2524710#M70557</link>
      <description>&lt;P&gt;Hi! I have this kind of problem in Power BI. I have a change number and status. As long as the last User Name is Change Analyst - Manila, I need to get the date difference from the previous date (second to the last date - this will be my start date). My end date would be the date from Change Analyst - Manila.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 May 2022 00:27:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Difference-between-LASTDATE-and-2nd-to-last-date/m-p/2524710#M70557</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-05-19T00:27:32Z</dc:date>
    </item>
  </channel>
</rss>

