<?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: remaining column to return previous payment amount in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/remaining-column-to-return-previous-payment-amount/m-p/3147866#M112683</link>
    <description>&lt;P&gt;Use the following code...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Previous Value Total = VAR currentDate = SELECTEDVALUE('pratic'[payment date])
VAR previousDate = MAXX(FILTER(ALL('pratic'),pratic[payment date]&amp;lt;currentDate &amp;amp;&amp;amp; 'pratic'[cod_client]=MAX('pratic'[cod_client])),'pratic'[payment date])
RETURN 
IF(ISINSCOPE('pratic'[cod_client]),
CALCULATE([Value Total],FILTER(ALLSELECTED('pratic'),previousDate='pratic'[payment date]))
,[Value Total])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;You could also use the following to check if PaymentDate is being used and default the value to Total if not...&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Previous Value Total = VAR currentDate = SELECTEDVALUE('pratic'[payment date])
VAR previousDate = MAXX(FILTER(ALL('pratic'),pratic[payment date]&amp;lt;currentDate &amp;amp;&amp;amp; 'pratic'[cod_client]=MAX('pratic'[cod_client])),'pratic'[payment date])
RETURN 
SWITCH(TRUE()
,AND(ISINSCOPE('pratic'[cod_client]),(ISINSCOPE(pratic[payment date]))), CALCULATE([Value Total],FILTER(ALLSELECTED('pratic'),previousDate='pratic'[payment date]))
,AND(ISINSCOPE('pratic'[cod_client]),NOT(ISINSCOPE(pratic[payment date]))),[Value Total]
,[Value Total])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Mar 2023 17:20:03 GMT</pubDate>
    <dc:creator>BrianConnelly</dc:creator>
    <dc:date>2023-03-22T17:20:03Z</dc:date>
    <item>
      <title>remaining column to return previous payment amount</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/remaining-column-to-return-previous-payment-amount/m-p/3147815#M112681</link>
      <description>&lt;P&gt;Good afternoon.&lt;BR /&gt;I need help creating a calculated column that returns the customer's previous payment amount.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;example. Line 1 of the image below.&lt;/P&gt;&lt;P&gt;For the customer abc123, the value of the first must bring in a new column the value of 40 (referring to the payment made on 2021-10-05)&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;if there is no previous payment show empty&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Link download do pbix.&lt;/P&gt;&lt;P&gt;&lt;A href="https://drive.google.com/file/d/1Sw5hZGNfZyK5_xz8C4yR2yQiwGun3z66/view?usp=sharing" target="_blank"&gt;https://drive.google.com/file/d/1Sw5hZGNfZyK5_xz8C4yR2yQiwGun3z66/view?usp=sharing&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks if anyone can take the time to hel&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2023 16:51:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/remaining-column-to-return-previous-payment-amount/m-p/3147815#M112681</guid>
      <dc:creator>RSSILVA_22</dc:creator>
      <dc:date>2023-03-22T16:51:23Z</dc:date>
    </item>
    <item>
      <title>Re: remaining column to return previous payment amount</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/remaining-column-to-return-previous-payment-amount/m-p/3147866#M112683</link>
      <description>&lt;P&gt;Use the following code...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Previous Value Total = VAR currentDate = SELECTEDVALUE('pratic'[payment date])
VAR previousDate = MAXX(FILTER(ALL('pratic'),pratic[payment date]&amp;lt;currentDate &amp;amp;&amp;amp; 'pratic'[cod_client]=MAX('pratic'[cod_client])),'pratic'[payment date])
RETURN 
IF(ISINSCOPE('pratic'[cod_client]),
CALCULATE([Value Total],FILTER(ALLSELECTED('pratic'),previousDate='pratic'[payment date]))
,[Value Total])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;You could also use the following to check if PaymentDate is being used and default the value to Total if not...&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Previous Value Total = VAR currentDate = SELECTEDVALUE('pratic'[payment date])
VAR previousDate = MAXX(FILTER(ALL('pratic'),pratic[payment date]&amp;lt;currentDate &amp;amp;&amp;amp; 'pratic'[cod_client]=MAX('pratic'[cod_client])),'pratic'[payment date])
RETURN 
SWITCH(TRUE()
,AND(ISINSCOPE('pratic'[cod_client]),(ISINSCOPE(pratic[payment date]))), CALCULATE([Value Total],FILTER(ALLSELECTED('pratic'),previousDate='pratic'[payment date]))
,AND(ISINSCOPE('pratic'[cod_client]),NOT(ISINSCOPE(pratic[payment date]))),[Value Total]
,[Value Total])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2023 17:20:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/remaining-column-to-return-previous-payment-amount/m-p/3147866#M112683</guid>
      <dc:creator>BrianConnelly</dc:creator>
      <dc:date>2023-03-22T17:20:03Z</dc:date>
    </item>
    <item>
      <title>Re: remaining column to return previous payment amount</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/remaining-column-to-return-previous-payment-amount/m-p/3148019#M112694</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="338091" data-lia-user-login="RSSILVA_22" class="lia-mention lia-mention-user"&gt;RSSILVA_22&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if you're looking for a calculated column then please try&lt;/P&gt;
&lt;P&gt;Previous Payment =&lt;BR /&gt;VAR CurrentDate = 'Table'[payment date]&lt;BR /&gt;VAR CurrentTable =&lt;BR /&gt;CALCULATETABLE ( 'Table', ALLEXCEPT ( 'Table', 'Table'[cod_client] ) )&lt;BR /&gt;VAR TableBefore =&lt;BR /&gt;FILTER ( CurrentTable, 'Table'[payment date] &amp;lt; CurrentDate )&lt;BR /&gt;VAR PreviousRecord =&lt;BR /&gt;TOPN ( 1, TableBefore, 'Table'[payment date] )&lt;BR /&gt;RETURN&lt;BR /&gt;MAXX ( PreviousRecord, 'Table'[value] )&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2023 18:19:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/remaining-column-to-return-previous-payment-amount/m-p/3148019#M112694</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-03-22T18:19:00Z</dc:date>
    </item>
    <item>
      <title>Re: remaining column to return previous payment amount</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/remaining-column-to-return-previous-payment-amount/m-p/3150009#M112810</link>
      <description>&lt;P&gt;very good&lt;BR /&gt;thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2023 13:28:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/remaining-column-to-return-previous-payment-amount/m-p/3150009#M112810</guid>
      <dc:creator>RSSILVA_22</dc:creator>
      <dc:date>2023-03-23T13:28:17Z</dc:date>
    </item>
    <item>
      <title>Re: remaining column to return previous payment amount</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/remaining-column-to-return-previous-payment-amount/m-p/3150028#M112811</link>
      <description>&lt;P&gt;Thanks for the feedback.&lt;BR /&gt;Very good instructions.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2023 13:32:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/remaining-column-to-return-previous-payment-amount/m-p/3150028#M112811</guid>
      <dc:creator>RSSILVA_22</dc:creator>
      <dc:date>2023-03-23T13:32:34Z</dc:date>
    </item>
  </channel>
</rss>

