<?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: show last value on or before selected date in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/show-last-value-on-or-before-selected-date/m-p/1057624#M14621</link>
    <description>&lt;P&gt;Here is one approach to do it.&amp;nbsp; I made a mock table called Table that doesn't have balances for every date, and a Date table that has all dates.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Latest Day Balance = var selecteddate = SELECTEDVALUE('Date'[Date])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var maxbalancedate = CALCULATE(MAX('Table'[BalanceDate]), ALL('Date'[Date]), 'Table'[BalanceDate]&amp;lt;=selecteddate)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;return CALCULATE([Total], 'Date'[Date]=maxbalancedate)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;If this works for you, please mark it as the solution.&amp;nbsp; Please let me know if any questions.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Pat&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Wed, 29 Apr 2020 23:15:30 GMT</pubDate>
    <dc:creator>mahoneypat</dc:creator>
    <dc:date>2020-04-29T23:15:30Z</dc:date>
    <item>
      <title>show last value on or before selected date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/show-last-value-on-or-before-selected-date/m-p/1056814#M14592</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table that contains daily balances for several accounts by date.&amp;nbsp; It doesn't have an entry for every date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The user selects a date they are interested in, I would like to display each account by value on a&amp;nbsp;Clutered bar chart.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to create a measure that will calculate a value.&amp;nbsp; If the an entry doesn't exist for the selected date I would like the value of last entry before the selected date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what I have so far but is giving me the error max has been used in a true/false expression that is used as a table filter&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;LastValueAmmount = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; CALCULATE(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [Total Value],&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; FILTER( &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ALL('Statement Date'[Date]),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; LASTNONBLANK('Statement Date'[Date],[Total Value])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; , 'Statement Date'[Date] &amp;lt;= MAX ( 'Statement Date'[Date] )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;[Total Value] is a measure I have created and just totals the closing balance&amp;nbsp; field.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here is my model&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;thank you for all help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Apr 2020 14:41:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/show-last-value-on-or-before-selected-date/m-p/1056814#M14592</guid>
      <dc:creator>jasemilly</dc:creator>
      <dc:date>2020-04-29T14:41:07Z</dc:date>
    </item>
    <item>
      <title>Re: show last value on or before selected date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/show-last-value-on-or-before-selected-date/m-p/1057624#M14621</link>
      <description>&lt;P&gt;Here is one approach to do it.&amp;nbsp; I made a mock table called Table that doesn't have balances for every date, and a Date table that has all dates.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Latest Day Balance = var selecteddate = SELECTEDVALUE('Date'[Date])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var maxbalancedate = CALCULATE(MAX('Table'[BalanceDate]), ALL('Date'[Date]), 'Table'[BalanceDate]&amp;lt;=selecteddate)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;return CALCULATE([Total], 'Date'[Date]=maxbalancedate)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;If this works for you, please mark it as the solution.&amp;nbsp; Please let me know if any questions.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Pat&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 29 Apr 2020 23:15:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/show-last-value-on-or-before-selected-date/m-p/1057624#M14621</guid>
      <dc:creator>mahoneypat</dc:creator>
      <dc:date>2020-04-29T23:15:30Z</dc:date>
    </item>
    <item>
      <title>Re: show last value on or before selected date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/show-last-value-on-or-before-selected-date/m-p/1064085#M14846</link>
      <description>Please refer to this article to learn how to properly calculate balances:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://www.sqlbi.com/articles/semi-additive-measures-in-dax/" target="_blank"&gt;https://www.sqlbi.com/articles/semi-additive-measures-in-dax/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;For other common patterns, you can always use &lt;A href="http://www.daxpatterns.com" target="_blank"&gt;www.daxpatterns.com&lt;/A&gt;.&lt;BR /&gt;&lt;BR /&gt;Best&lt;BR /&gt;D</description>
      <pubDate>Sun, 03 May 2020 11:07:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/show-last-value-on-or-before-selected-date/m-p/1064085#M14846</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-05-03T11:07:06Z</dc:date>
    </item>
    <item>
      <title>Re: show last value on or before selected date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/show-last-value-on-or-before-selected-date/m-p/1072054#M14964</link>
      <description>&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="226208" data-lia-user-login="mahoneypat" class="lia-mention lia-mention-user"&gt;mahoneypat&lt;/a&gt;, &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="181440" data-lia-user-login="jasemilly" class="lia-mention lia-mention-user"&gt;jasemilly&lt;/a&gt;...&lt;BR /&gt;&lt;BR /&gt;The solution you gave and accepted is not correct if you have different accounts and the last date recorded for each account can be different.&lt;BR /&gt;&lt;BR /&gt;Best&lt;BR /&gt;D</description>
      <pubDate>Tue, 05 May 2020 07:42:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/show-last-value-on-or-before-selected-date/m-p/1072054#M14964</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-05-05T07:42:28Z</dc:date>
    </item>
    <item>
      <title>Re: show last value on or before selected date</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/show-last-value-on-or-before-selected-date/m-p/3711015#M144384</link>
      <description>&lt;P&gt;I get the following error when attrmpting this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The value for 'Total' cannot be determined. Either the column doesn't exist, or there is no current row for this column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do I have something in the wrong location or am I missunderstanding something?&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2024 12:32:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/show-last-value-on-or-before-selected-date/m-p/3711015#M144384</guid>
      <dc:creator>techno</dc:creator>
      <dc:date>2024-02-20T12:32:14Z</dc:date>
    </item>
  </channel>
</rss>

