<?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: Last value of each bank account per year &amp;amp; month in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-value-of-each-bank-account-per-year-amp-month/m-p/2253226#M54342</link>
    <description>&lt;P&gt;Thanks for your replies. It seems that it is more complicated than I thought.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As I haven't done so much with DAX until now, I will need to start from the beginning and then I will try your suggestions &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I am still open for other proposals ...&amp;nbsp; there are always many different ways for problems like that &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 23 Dec 2021 07:45:54 GMT</pubDate>
    <dc:creator>MoFiMo</dc:creator>
    <dc:date>2021-12-23T07:45:54Z</dc:date>
    <item>
      <title>Last value of each bank account per year &amp; month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-value-of-each-bank-account-per-year-amp-month/m-p/2252538#M54291</link>
      <description>&lt;P&gt;Hello.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried several things and maybe I am just thinking too complicated. Therefore I will ask you for support &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In general I have already a workaround in Excel, as I started long ago with a dashboard in Excel. But now I want to transfer it. I have the following situation:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my table there are listed several accounts with several bookings on the same days, but not on each day in a month (like a normal bank account).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;Account&lt;/TD&gt;&lt;TD&gt;Booking&lt;/TD&gt;&lt;TD&gt;End of day Value&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000"&gt;25.01.2021&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000"&gt;A&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000"&gt;150&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000"&gt;150&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;28.01.2021&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;B&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;5000&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;5000&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;28.01.2021&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;A&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;-50&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;100&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;27.02.2021&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;A&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;-60&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;40&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;28.02.2021&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;-500&lt;/TD&gt;&lt;TD&gt;3000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;28.02.2021&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;B&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;-1500&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;3000&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;15.03.2021&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;A&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;360&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;400&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;21.03.2021&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;B&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;3200&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;6200&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;...&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;01.04.2021&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;A&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;-30&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#FF0000"&gt;370&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I would like to extract the "End of day value" for each account per month &amp;amp; year. But I cannot take the last day of each month like 31.01.2021, 28.02.2021 ... as it is not a must that there was a booking on those days.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;Account&lt;/TD&gt;&lt;TD&gt;End of day value&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;28.01.2021&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;28.01.2021&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;5000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;27.02.2021&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;40&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;28.02.2021&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;3000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000"&gt;15.03.2021&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000"&gt;A&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;400&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000"&gt;21.03.2021&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000"&gt;B&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;6200&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000"&gt;....&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't care if it's just a visual + filtering or if I create a DAX statement for a new table or measure.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here my comparison of what I have (many data points)&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;and what I want to achieve (just one data point for each month+year)&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope you got my point. It's a little bit difficult to describe &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Dec 2021 18:14:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-value-of-each-bank-account-per-year-amp-month/m-p/2252538#M54291</guid>
      <dc:creator>MoFiMo</dc:creator>
      <dc:date>2021-12-22T18:14:08Z</dc:date>
    </item>
    <item>
      <title>Re: Last value of each bank account per year &amp; month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-value-of-each-bank-account-per-year-amp-month/m-p/2252600#M54299</link>
      <description>&lt;P&gt;I think you need some DAX here and to make use of LASTNONBLANK.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have a read of&amp;nbsp;&lt;A href="https://www.sqlbi.com/articles/optimizing-lastnonblank-and-lastnonblankvalue-calculations/" target="_blank"&gt;https://www.sqlbi.com/articles/optimizing-lastnonblank-and-lastnonblankvalue-calculations/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you already have a date table in your model?&lt;/P&gt;</description>
      <pubDate>Wed, 22 Dec 2021 19:26:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-value-of-each-bank-account-per-year-amp-month/m-p/2252600#M54299</guid>
      <dc:creator>bcdobbs</dc:creator>
      <dc:date>2021-12-22T19:26:39Z</dc:date>
    </item>
    <item>
      <title>Re: Last value of each bank account per year &amp; month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-value-of-each-bank-account-per-year-amp-month/m-p/2252621#M54304</link>
      <description>&lt;P&gt;You can create a calculated table like that by adding a month column to group by and then finding the maximal date for each account/month combination.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example,&lt;/P&gt;
&lt;LI-CODE lang="php"&gt;Table2 =
VAR AddMonth = ADDCOLUMNS ( Table1, "MonthEnd", EOMONTH ( Table1[Date], 0 ) )
VAR FilterDate =
    FILTER (
        AddMonth,
        Table1[Date]
            = MAXX (
                FILTER (
                    AddMonth,
                    Table1[Account] = EARLIER ( Table1[Account] )
                      &amp;amp;&amp;amp; [MonthEnd] = EARLIER ( [MonthEnd] )
                ),
                Table1[Date]
            )
    )
RETURN
    SELECTCOLUMNS (
        FilterDate,
        "Date", Table1[Date],
        "End of day Value", Table1[End of day Value]
    )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think it might be better as a measure though like this:&lt;/P&gt;
&lt;LI-CODE lang="php"&gt;LastEoDValue = 
VAR CurrDay = MAX ( Table1[Date] )
VAR LastEoD = 
    CALCULATE (
        MAX ( Table1[Date] ),
        FILTER (
            ALLSELECTED ( Table1[Date] ),
            EOMONTH ( Table1[Date], 0 ) = EOMONTH ( CurrDay, 0 )
        )
    )
RETURN
    CALCULATE (
        SUM ( Table1[End of day Value] ),
        Table1[Date] = LastEoD
    )&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 22 Dec 2021 19:58:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-value-of-each-bank-account-per-year-amp-month/m-p/2252621#M54304</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2021-12-22T19:58:46Z</dc:date>
    </item>
    <item>
      <title>Re: Last value of each bank account per year &amp; month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-value-of-each-bank-account-per-year-amp-month/m-p/2253226#M54342</link>
      <description>&lt;P&gt;Thanks for your replies. It seems that it is more complicated than I thought.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As I haven't done so much with DAX until now, I will need to start from the beginning and then I will try your suggestions &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I am still open for other proposals ...&amp;nbsp; there are always many different ways for problems like that &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Dec 2021 07:45:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-value-of-each-bank-account-per-year-amp-month/m-p/2253226#M54342</guid>
      <dc:creator>MoFiMo</dc:creator>
      <dc:date>2021-12-23T07:45:54Z</dc:date>
    </item>
    <item>
      <title>Re: Last value of each bank account per year &amp; month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-value-of-each-bank-account-per-year-amp-month/m-p/2254378#M54388</link>
      <description>&lt;P&gt;Hello:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can use this measure, I believe:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Last Balance = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;( &lt;/SPAN&gt;&lt;SPAN&gt;LASTNONBLANKVALUE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;DISTINCT&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Dates[Date]&lt;/SPAN&gt;&lt;SPAN&gt;), &lt;/SPAN&gt;&lt;SPAN&gt;[Value Amt]&lt;/SPAN&gt;&lt;SPAN&gt;)). I will try to attach the file so you can see the model. Hope this helps. Bill S.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;You can get rid of the total with beginning with = IF(HASONEVALUE('Dates'[Month No.],&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 23 Dec 2021 22:27:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-value-of-each-bank-account-per-year-amp-month/m-p/2254378#M54388</guid>
      <dc:creator>Whitewater100</dc:creator>
      <dc:date>2021-12-23T22:27:33Z</dc:date>
    </item>
    <item>
      <title>Re: Last value of each bank account per year &amp; month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-value-of-each-bank-account-per-year-amp-month/m-p/2254379#M54389</link>
      <description>&lt;P&gt;Sorry [Value Amt] is just the sum of the ending balances.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Dec 2021 22:28:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-value-of-each-bank-account-per-year-amp-month/m-p/2254379#M54389</guid>
      <dc:creator>Whitewater100</dc:creator>
      <dc:date>2021-12-23T22:28:14Z</dc:date>
    </item>
    <item>
      <title>Re: Last value of each bank account per year &amp; month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-value-of-each-bank-account-per-year-amp-month/m-p/2256461#M54468</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="347575" data-lia-user-login="MoFiMo" class="lia-mention lia-mention-user"&gt;MoFiMo&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can try to create a max date of monthly column:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Max_date = CALCULATE(MAX('Table'[Date]),FILTER('Table',EARLIER('Table'[Account])='Table'[Account]&amp;amp;&amp;amp;EARLIER('Table'[Date].[Year])='Table'[Date].[Year]&amp;amp;&amp;amp;EARLIER('Table'[Date].[MonthNo])='Table'[Date].[MonthNo]))&lt;/LI-CODE&gt;
&lt;P&gt;Then create a new table:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Table 2 = 
distinct(SELECTCOLUMNS(FILTER('Table','Table'[Date]='Table'[Max_date]),"account",'Table'[Account],"date",'Table'[Date],"end_of_value",'Table'[End of day Value]))&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Best Regards,&lt;BR /&gt;Liang&lt;BR /&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>Mon, 27 Dec 2021 07:10:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Last-value-of-each-bank-account-per-year-amp-month/m-p/2256461#M54468</guid>
      <dc:creator>V-lianl-msft</dc:creator>
      <dc:date>2021-12-27T07:10:35Z</dc:date>
    </item>
  </channel>
</rss>

