<?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: Running balance ignoring other columns in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Running-balance-ignoring-other-columns/m-p/1519480#M29605</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="268458" data-lia-user-login="cdcaruba" class="lia-mention lia-mention-user"&gt;cdcaruba&lt;/a&gt;&amp;nbsp;, my bad, glad that you worked it out; but after a closer look at it, I think the measure can be authored this way,&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;cumulative balance :=
VAR maxDate = MAX ( dDate[Date] )
RETURN
    CALCULATE ( [TotalRevenue], dDate[Date] &amp;lt;= maxDate )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As to your question, I think you missed a very fundamental concept of DAX, evaluation context. Take a look at the illustration first,&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The most general rule for any DAX measures, a measure evaluates cell by cell; every cell has its own evaluation context for a measure.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Cell 1: Dates[Year]=2017, Dates[Month Number]=1, Product[ProductCategory]="Advanced"

Cell 2: Dates[Year]=2017, Dates[Month Number]=1, Product[ProductCategory]="Beginner"&lt;/LI-CODE&gt;&lt;P&gt;What's the logical relationship between these two categories for accumulation? Then with other items in the category? As long as you can describe such a logic, you can author a DAX for accumulation.&lt;/P&gt;</description>
    <pubDate>Thu, 26 Nov 2020 23:30:58 GMT</pubDate>
    <dc:creator>CNENFRNL</dc:creator>
    <dc:date>2020-11-26T23:30:58Z</dc:date>
    <item>
      <title>Running balance ignoring other columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Running-balance-ignoring-other-columns/m-p/1513848#M29434</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new to DAX and&amp;nbsp;have been looking for an answer for about a week now and I cant get it right.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The scenario is simple. I need a running total to create a balance that keeps on running, independant of other columns. So it just has to keep adding the previous row to the current row. The problem is with the product category column, that creates a group on which the RT is based on. I don't want that.&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;the DAX for "cumulative balance" =&amp;nbsp;&lt;/P&gt;&lt;P&gt;cumulative balance:=CALCULATE([TotalRevenue],&lt;BR /&gt;filter(ALLEXCEPT(dDate,dDate[Year],dDate[Month Number]),&lt;BR /&gt;dDate[Date] &amp;lt;= MAX(dDate[Date])&lt;BR /&gt;))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The data model is classic star schema with Sales fact , date dimension, product dimension.&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to ignore the product dimension and have the running total keep on totalling?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Nov 2020 13:36:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Running-balance-ignoring-other-columns/m-p/1513848#M29434</guid>
      <dc:creator>cdcaruba</dc:creator>
      <dc:date>2020-11-24T13:36:55Z</dc:date>
    </item>
    <item>
      <title>Re: Running balance ignoring other columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Running-balance-ignoring-other-columns/m-p/1514182#M29442</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="268458" data-lia-user-login="cdcaruba" class="lia-mention lia-mention-user"&gt;cdcaruba&lt;/a&gt;&amp;nbsp;, it seems you're intended to apply filters this way,&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;cumulative balance :=
CALCULATE (
    [TotalRevenue],
    dDate[Date] &amp;lt;= MAX ( dDate[Date] ),
    ALLEXCEPT ( dDate, dDate[Year], dDate[Month Number] )
)&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 24 Nov 2020 15:44:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Running-balance-ignoring-other-columns/m-p/1514182#M29442</guid>
      <dc:creator>CNENFRNL</dc:creator>
      <dc:date>2020-11-24T15:44:49Z</dc:date>
    </item>
    <item>
      <title>Re: Running balance ignoring other columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Running-balance-ignoring-other-columns/m-p/1514562#M29460</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="250150" data-lia-user-login="CNENFRNL" class="lia-mention lia-mention-user"&gt;CNENFRNL&lt;/a&gt;&amp;nbsp;, yes I actually tried that. Getting a calculation error:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;A function 'MAX' has been used in a True/False expression that is used as a table filter expression. This is not allowed.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;I am doing this in Excel by the way...&lt;/P&gt;</description>
      <pubDate>Tue, 24 Nov 2020 19:36:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Running-balance-ignoring-other-columns/m-p/1514562#M29460</guid>
      <dc:creator>cdcaruba</dc:creator>
      <dc:date>2020-11-24T19:36:08Z</dc:date>
    </item>
    <item>
      <title>Re: Running balance ignoring other columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Running-balance-ignoring-other-columns/m-p/1519407#M29602</link>
      <description>&lt;P&gt;Managed to fix the formula provided bij&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="250150" data-lia-user-login="CNENFRNL" class="lia-mention lia-mention-user"&gt;CNENFRNL&lt;/a&gt;&amp;nbsp;with a var&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;cumulative balance :=
var maxDate = MAX( dDate[Date] )
CALCULATE (
    [TotalRevenue],
    dDate[Date] &amp;lt;= maxDate,
    ALLEXCEPT ( dDate, dDate[Year], dDate[Month Number] )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;, but the result is still the same.&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I am I missing here??&lt;/P&gt;</description>
      <pubDate>Thu, 26 Nov 2020 21:27:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Running-balance-ignoring-other-columns/m-p/1519407#M29602</guid>
      <dc:creator>cdcaruba</dc:creator>
      <dc:date>2020-11-26T21:27:23Z</dc:date>
    </item>
    <item>
      <title>Re: Running balance ignoring other columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Running-balance-ignoring-other-columns/m-p/1519480#M29605</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="268458" data-lia-user-login="cdcaruba" class="lia-mention lia-mention-user"&gt;cdcaruba&lt;/a&gt;&amp;nbsp;, my bad, glad that you worked it out; but after a closer look at it, I think the measure can be authored this way,&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;cumulative balance :=
VAR maxDate = MAX ( dDate[Date] )
RETURN
    CALCULATE ( [TotalRevenue], dDate[Date] &amp;lt;= maxDate )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As to your question, I think you missed a very fundamental concept of DAX, evaluation context. Take a look at the illustration first,&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The most general rule for any DAX measures, a measure evaluates cell by cell; every cell has its own evaluation context for a measure.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Cell 1: Dates[Year]=2017, Dates[Month Number]=1, Product[ProductCategory]="Advanced"

Cell 2: Dates[Year]=2017, Dates[Month Number]=1, Product[ProductCategory]="Beginner"&lt;/LI-CODE&gt;&lt;P&gt;What's the logical relationship between these two categories for accumulation? Then with other items in the category? As long as you can describe such a logic, you can author a DAX for accumulation.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Nov 2020 23:30:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Running-balance-ignoring-other-columns/m-p/1519480#M29605</guid>
      <dc:creator>CNENFRNL</dc:creator>
      <dc:date>2020-11-26T23:30:58Z</dc:date>
    </item>
    <item>
      <title>Re: Running balance ignoring other columns</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Running-balance-ignoring-other-columns/m-p/1521074#M29645</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="250150" data-lia-user-login="CNENFRNL" class="lia-mention lia-mention-user"&gt;CNENFRNL&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am beginning to understand a bit better. When you say 'cell' do you mean 'row'? (As this is in Excel and a cell is really just the one cell).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Lets concider a slightly different table: in stead op category we use ProductID&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Perhaps a relationship can be created by concatenating the productID and the YearMonth column, creating a YearMonthProductID column (but I dont want to show it in the results)?&lt;/P&gt;&lt;P&gt;This is almost it, but obviously it resets at the next month.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;cumulative balance:=var maxProdID = MAX( dProduct[ProductID] )
RETURN
    CALCULATE ( [TotalRevenue], dProduct[ProductID] &amp;lt;= maxProdID )&lt;/LI-CODE&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I have the feeling all will be soleved if it was possible to create a dynamic rownumber for the whole table, but I haven't been able to figure that out.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Nov 2020 14:43:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Running-balance-ignoring-other-columns/m-p/1521074#M29645</guid>
      <dc:creator>cdcaruba</dc:creator>
      <dc:date>2020-11-27T14:43:11Z</dc:date>
    </item>
  </channel>
</rss>

