<?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: Second Last Value in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Second-Last-Value/m-p/3065819#M41073</link>
    <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here I suggest you to try below codes to create [Last Trans] and [Second Last Trans] measures.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Second Last Trans =
VAR _Last_Date =
    MAXX (
        FILTER (
            ALL ( 'Market Prices' ),
            'Market Prices'[Symbol] = MAX ( 'Market Prices'[Symbol] )
                &amp;amp;&amp;amp; 'Market Prices'[Date] &amp;lt; MAX ( 'Market Prices'[Date] )
        ),
        'Market Prices'[Date]
    )
RETURN
    CALCULATE (
        SUM ( 'Market Prices'[Value] ),
        FILTER ( 'Market Prices', 'Market Prices'[Date] = _Last_Date )
    )&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Last Trans = 
VAR _Last_Date =
    MAXX (
        FILTER (
            ALL ( 'Market Prices' ),
            'Market Prices'[Symbol] = MAX ( 'Market Prices'[Symbol] )
        ),
        'Market Prices'[Date]
    )
RETURN
    CALCULATE (
        SUM ( 'Market Prices'[Value] ),
        FILTER ( 'Market Prices', 'Market Prices'[Date] = _Last_Date )
    )&lt;/LI-CODE&gt;
&lt;P&gt;My Sample:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RicoZhou_1-1675761718814.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/867553i1BC5DECFB3156B8D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RicoZhou_1-1675761718814.png" alt="RicoZhou_1-1675761718814.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Result is as below.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RicoZhou_0-1675761699026.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/867552i540E893C0C6B1C4B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RicoZhou_0-1675761699026.png" alt="RicoZhou_0-1675761699026.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Rico Zhou&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;</description>
    <pubDate>Tue, 07 Feb 2023 09:22:32 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-02-07T09:22:32Z</dc:date>
    <item>
      <title>Second Last Value</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Second-Last-Value/m-p/3051625#M40970</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have successfully produced the last value using this calculation:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;EM&gt;Last Value = &lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;SUMX(FILTER('Market Prices','Market Prices'[Date]=LASTDATE('Market Prices'[Date])),'Market Prices'[Value])&lt;/EM&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Which gets used by:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;EM&gt;Last Trans = &lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;VAR Last_Date = Lastdate('Market Prices'[Date])&lt;/EM&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;EM&gt;RETURN&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;CALCULATE([Last Value],&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; Filter(All('Market Prices'[Date]),&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; 'Market Prices'[Date] = Last_Date))&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Fergo_0-1675136725145.png" style="width: 158px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/863816i14B31F9D6027109A/image-dimensions/158x229?v=v2" width="158" height="229" role="button" title="Fergo_0-1675136725145.png" alt="Fergo_0-1675136725145.png" /&gt;&lt;/span&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;DIV&gt;But I am having trouble getting second last transaction (Transaction before last transaction).&amp;nbsp;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 31 Jan 2023 03:46:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Second-Last-Value/m-p/3051625#M40970</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-01-31T03:46:08Z</dc:date>
    </item>
    <item>
      <title>Re: Second Last Value</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Second-Last-Value/m-p/3065819#M41073</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here I suggest you to try below codes to create [Last Trans] and [Second Last Trans] measures.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Second Last Trans =
VAR _Last_Date =
    MAXX (
        FILTER (
            ALL ( 'Market Prices' ),
            'Market Prices'[Symbol] = MAX ( 'Market Prices'[Symbol] )
                &amp;amp;&amp;amp; 'Market Prices'[Date] &amp;lt; MAX ( 'Market Prices'[Date] )
        ),
        'Market Prices'[Date]
    )
RETURN
    CALCULATE (
        SUM ( 'Market Prices'[Value] ),
        FILTER ( 'Market Prices', 'Market Prices'[Date] = _Last_Date )
    )&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Last Trans = 
VAR _Last_Date =
    MAXX (
        FILTER (
            ALL ( 'Market Prices' ),
            'Market Prices'[Symbol] = MAX ( 'Market Prices'[Symbol] )
        ),
        'Market Prices'[Date]
    )
RETURN
    CALCULATE (
        SUM ( 'Market Prices'[Value] ),
        FILTER ( 'Market Prices', 'Market Prices'[Date] = _Last_Date )
    )&lt;/LI-CODE&gt;
&lt;P&gt;My Sample:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RicoZhou_1-1675761718814.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/867553i1BC5DECFB3156B8D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RicoZhou_1-1675761718814.png" alt="RicoZhou_1-1675761718814.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Result is as below.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RicoZhou_0-1675761699026.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/867552i540E893C0C6B1C4B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RicoZhou_0-1675761699026.png" alt="RicoZhou_0-1675761699026.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Rico Zhou&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2023 09:22:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Second-Last-Value/m-p/3065819#M41073</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-02-07T09:22:32Z</dc:date>
    </item>
    <item>
      <title>Re: Second Last Value</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Second-Last-Value/m-p/3067761#M41087</link>
      <description>&lt;P&gt;Cheers, that looks great.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Feb 2023 04:04:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Second-Last-Value/m-p/3067761#M41087</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-02-08T04:04:50Z</dc:date>
    </item>
  </channel>
</rss>

