<?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: Sort order breaks running total measure!! in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sort-order-breaks-running-total-measure/m-p/3216759#M117453</link>
    <description>&lt;P&gt;Try this version&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="css"&gt;Goal Running Total = 
var mx = MAX('Week Order'[Week Of])
return CALCULATE( sum(Sales[Goal]),'Week Order'[Week Of] &amp;lt;= mx)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 02 May 2023 23:48:50 GMT</pubDate>
    <dc:creator>lbendlin</dc:creator>
    <dc:date>2023-05-02T23:48:50Z</dc:date>
    <item>
      <title>Sort order breaks running total measure!!</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sort-order-breaks-running-total-measure/m-p/3214318#M117327</link>
      <description>&lt;P&gt;I have a simple sales table below: 'Sales'&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;This thrown into a simple Matrix looks like this:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My objective is to move the TOTALs to the front of the matrix (left) and then to create a measure that results in a running total week over week of the Goal amounts. To do this I created a new table ( 'Week Order' ) to sum all data across all date points. See picture below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I then related the two tables on 'Sales'[Week] and 'Week Order'[Week Date]&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;This allows me to use 'Week Order'[Week Of] as the column object in my matrix.&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I need to create a measure to calculate the running total of the Goal amounts.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="css"&gt;Goal Running Total = CALCULATE(
    sum(Sales[Goal]),
    FILTER(
        all('Week Order'[Week Of]),
        'Week Order'[Week Of] &amp;lt;= MAX('Week Order'[Week Of])
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I throw this measure into the matrix everything works fine before sorting [Week Of]. You can see below that the running total for goals adds each week. 4/10/23 = 250, 4/17/23 = 100 + 250, 4/3/2023 = 125+ 100 + 250&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Now, when I sort [Week Of] by [Order] the measure no longer compiles the Goal total each week.&lt;/P&gt;&lt;P&gt;This is the problem I need help solving.&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;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2023 14:14:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sort-order-breaks-running-total-measure/m-p/3214318#M117327</guid>
      <dc:creator>DJSwezey</dc:creator>
      <dc:date>2023-05-02T14:14:02Z</dc:date>
    </item>
    <item>
      <title>Re: Sort order breaks running total measure!!</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sort-order-breaks-running-total-measure/m-p/3216759#M117453</link>
      <description>&lt;P&gt;Try this version&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="css"&gt;Goal Running Total = 
var mx = MAX('Week Order'[Week Of])
return CALCULATE( sum(Sales[Goal]),'Week Order'[Week Of] &amp;lt;= mx)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2023 23:48:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sort-order-breaks-running-total-measure/m-p/3216759#M117453</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2023-05-02T23:48:50Z</dc:date>
    </item>
  </channel>
</rss>

