<?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 Total in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Running-Total/m-p/2517392#M70058</link>
    <description>&lt;P&gt;Also, look at my code &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="339465" data-lia-user-login="ID" class="lia-mention lia-mention-user"&gt;ID&lt;/a&gt; is a temporary column I created. I'm adding @ to distinguish it from regular model columns&lt;/P&gt;</description>
    <pubDate>Mon, 16 May 2022 11:39:14 GMT</pubDate>
    <dc:creator>SpartaBI</dc:creator>
    <dc:date>2022-05-16T11:39:14Z</dc:date>
    <item>
      <title>Running Total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Running-Total/m-p/2515003#M69900</link>
      <description>&lt;P&gt;HHello, I don't know, how to write in dax Running Total Query for below situation:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I only find examples for situations where the Count ID is not similar in one Column. So I get values in Column Actual Running Total. Do you know how to write it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 14 May 2022 11:49:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Running-Total/m-p/2515003#M69900</guid>
      <dc:creator>LiborK</dc:creator>
      <dc:date>2022-05-14T11:49:36Z</dc:date>
    </item>
    <item>
      <title>Re: Running Total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Running-Total/m-p/2515015#M69901</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="389851" data-lia-user-login="LiborK" class="lia-mention lia-mention-user"&gt;LiborK&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;would you please clarify further?&lt;/P&gt;</description>
      <pubDate>Sat, 14 May 2022 12:03:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Running-Total/m-p/2515015#M69901</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-05-14T12:03:11Z</dc:date>
    </item>
    <item>
      <title>Re: Running Total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Running-Total/m-p/2515021#M69903</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="389851" data-lia-user-login="LiborK" class="lia-mention lia-mention-user"&gt;LiborK&lt;/a&gt;&amp;nbsp;yes, but you need to choose which one is your 2nd important column for the sorting (the 1st is of course the [Count ID] )&lt;BR /&gt;Let's say it's the [ID] column and let's say higher ID -&amp;gt; Higher rank&lt;BR /&gt;So, first, create this calculated column:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;'Table'[Sorting] = 'Table'[Count ID] * ROUND(MAX('Table'[ID]), -1) + 'Table'[ID].&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Then create this Count RT column:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;'Table'[Count RT] =
VAR _current_rank = 'Table'[Sorting]
RETURN
SUMX(FILTER('Table, 'Table'[Sorting] &amp;lt;= _current_rank), 'Table'[% ID])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Data-Stories-Gallery/Contoso-by-SpartaBI/m-p/2449543" target="_blank" rel="noopener"&gt;Showcase Report – Contoso By SpartaBI&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;A href="https://www.spartabi.com" target="_blank" rel="noopener"&gt;&lt;img /&gt;&lt;/A&gt;&amp;nbsp;&amp;nbsp;&lt;A href="https://www.linkedin.com/company/spartabi" target="_blank" rel="noopener"&gt;&lt;img /&gt;&lt;/A&gt; &amp;nbsp;&amp;nbsp;&lt;A href="https://www.facebook.com/SpartaBI" target="_blank" rel="noopener"&gt;&lt;img /&gt;&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://www.spartabi.com" target="_blank" rel="noopener"&gt;&lt;img /&gt;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 14 May 2022 12:14:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Running-Total/m-p/2515021#M69903</guid>
      <dc:creator>SpartaBI</dc:creator>
      <dc:date>2022-05-14T12:14:12Z</dc:date>
    </item>
    <item>
      <title>Re: Running Total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Running-Total/m-p/2515898#M69981</link>
      <description>&lt;P&gt;Hi, thank you for you answer, but I am not able to choose&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;'Table'[Sorting] = 'Table'[Count ID] * ROUND(MAX('Table'[ID]), -1) + &lt;STRONG&gt;'Table'[ID].&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;'Table' [ID] in second step after "+" it says Cannot find name 'ID'.&lt;/P&gt;&lt;P&gt;If its helps Count IDs, Total Count Of IDs, %ID, Actual Running Sum are measures...&lt;/P&gt;</description>
      <pubDate>Sun, 15 May 2022 19:12:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Running-Total/m-p/2515898#M69981</guid>
      <dc:creator>LiborK</dc:creator>
      <dc:date>2022-05-15T19:12:46Z</dc:date>
    </item>
    <item>
      <title>Re: Running Total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Running-Total/m-p/2515905#M69982</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="389851" data-lia-user-login="LiborK" class="lia-mention lia-mention-user"&gt;LiborK&lt;/a&gt;&amp;nbsp;you have that column in your model? 'Table'[ID]?&lt;/P&gt;&lt;P&gt;Also, the picture you sent is a matrix visual where you put that column on the rows of a matrix and all the rest are measures? Is all coming from the same table or there are several tables involved? Best if you can share the file but maybe will be able to answer without, just with answers to my questions.&lt;/P&gt;</description>
      <pubDate>Sun, 15 May 2022 19:35:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Running-Total/m-p/2515905#M69982</guid>
      <dc:creator>SpartaBI</dc:creator>
      <dc:date>2022-05-15T19:35:17Z</dc:date>
    </item>
    <item>
      <title>Re: Running Total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Running-Total/m-p/2516954#M70029</link>
      <description>&lt;P&gt;Yes, the column is in my model...I am able to find it for the &lt;FONT color="#008000"&gt;green &lt;SPAN&gt;colored&lt;/SPAN&gt; part&lt;/FONT&gt;, but not for the &lt;FONT color="#FF0000"&gt;red &lt;SPAN&gt;colored&lt;/SPAN&gt;&amp;nbsp;part:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;'Table'[Sorting] = 'Table'[Count ID] * ROUND(MAX&lt;FONT color="#008000"&gt;('Table'[ID])&lt;/FONT&gt;, -1) + &lt;FONT color="#FF0000"&gt;'Table'[ID],&amp;nbsp;&lt;FONT color="#000000"&gt;only column which is not measure is "ID" from the example above, but it is distinct like in pivot table. Original table looks like this example:&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;&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>Mon, 16 May 2022 08:53:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Running-Total/m-p/2516954#M70029</guid>
      <dc:creator>LiborK</dc:creator>
      <dc:date>2022-05-16T08:53:07Z</dc:date>
    </item>
    <item>
      <title>Re: Running Total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Running-Total/m-p/2517227#M70043</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="389851" data-lia-user-login="LiborK" class="lia-mention lia-mention-user"&gt;LiborK&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;So, no calculated columns. Create this measure:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Count RT = 
VAR _current_count = [COUNT ID'S]
VAR _current_id = SELECTEDVALUE('Table'[ID])
VAR _max_customer_id = 
    ROUND(CALCULATE(MAX('Table'[ID]), ALLSELECTED('Table'[ID]),-1)
VAR _ranking_table = 
    ADDCOLUMNS(
        ALLSELECTED('Table'[ID]),
        "@%ID", [% ID],
        "@Ranking", [COUNT ID'S] * _max_customer_id + 'Table'[ID]
    ) 
VAR _current_rank =  _current_sales * _max_customer_id + _current_id
VAR _result = 
    SUMX(
        FILTER(
            _ranking_table,
            [@Ranking] &amp;gt;= _current_rank
        ),
        [@%ID]
    ) 
RETURN 
    _result&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Data-Stories-Gallery/Contoso-by-SpartaBI/m-p/2449543" target="_blank" rel="noopener"&gt;Showcase Report – Contoso By SpartaBI&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;A href="https://www.spartabi.com" target="_blank" rel="noopener"&gt;&lt;img /&gt;&lt;/A&gt;&amp;nbsp;&amp;nbsp;&lt;A href="https://www.linkedin.com/company/spartabi" target="_blank" rel="noopener"&gt;&lt;img /&gt;&lt;/A&gt; &amp;nbsp;&amp;nbsp;&lt;A href="https://www.facebook.com/SpartaBI" target="_blank" rel="noopener"&gt;&lt;img /&gt;&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://www.spartabi.com" target="_blank" rel="noopener"&gt;&lt;img /&gt;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 16 May 2022 10:10:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Running-Total/m-p/2517227#M70043</guid>
      <dc:creator>SpartaBI</dc:creator>
      <dc:date>2022-05-16T10:10:33Z</dc:date>
    </item>
    <item>
      <title>Re: Running Total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Running-Total/m-p/2517385#M70055</link>
      <description>&lt;P&gt;Thank you so much for your help, but it is still not working...I will try to describe it in different way.&lt;/P&gt;&lt;P&gt;I have just table with this column "ID" and values in this column are with structure like in picture below ( for example 13, can be there multiple times) and I dont have there any other measures.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And my task is to create table where in first column will be ID (for each row unique ID) and the rest of the column will be like in picture 2&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;and I am able to create measures for column B-E, but I am not able to create measure for column F.&lt;/P&gt;&lt;P&gt;VAR _ranking_table =&lt;BR /&gt;ADDCOLUMNS(&lt;BR /&gt;ALLSELECTED('Table'[ID]),&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;"@%ID"(parametr is not in correct type)&lt;/FONT&gt;, &lt;FONT color="#FF0000"&gt;[% ID](I am not able to find the measure, it provide me just standard column from model)&lt;/FONT&gt;,&lt;BR /&gt;"@Ranking", [COUNT ID'S] * _max_customer_id + 'Table'[ID]&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Mon, 16 May 2022 11:25:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Running-Total/m-p/2517385#M70055</guid>
      <dc:creator>LiborK</dc:creator>
      <dc:date>2022-05-16T11:25:46Z</dc:date>
    </item>
    <item>
      <title>Re: Running Total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Running-Total/m-p/2517389#M70057</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="389851" data-lia-user-login="LiborK" class="lia-mention lia-mention-user"&gt;LiborK&lt;/a&gt;&amp;nbsp;are you trying to create a matrix visual or a calculated table?&lt;/P&gt;</description>
      <pubDate>Mon, 16 May 2022 11:36:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Running-Total/m-p/2517389#M70057</guid>
      <dc:creator>SpartaBI</dc:creator>
      <dc:date>2022-05-16T11:36:21Z</dc:date>
    </item>
    <item>
      <title>Re: Running Total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Running-Total/m-p/2517392#M70058</link>
      <description>&lt;P&gt;Also, look at my code &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="339465" data-lia-user-login="ID" class="lia-mention lia-mention-user"&gt;ID&lt;/a&gt; is a temporary column I created. I'm adding @ to distinguish it from regular model columns&lt;/P&gt;</description>
      <pubDate>Mon, 16 May 2022 11:39:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Running-Total/m-p/2517392#M70058</guid>
      <dc:creator>SpartaBI</dc:creator>
      <dc:date>2022-05-16T11:39:14Z</dc:date>
    </item>
    <item>
      <title>Re: Running Total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Running-Total/m-p/2517406#M70059</link>
      <description>&lt;P&gt;Table&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 May 2022 11:44:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Running-Total/m-p/2517406#M70059</guid>
      <dc:creator>LiborK</dc:creator>
      <dc:date>2022-05-16T11:44:14Z</dc:date>
    </item>
    <item>
      <title>Re: Running Total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Running-Total/m-p/2517426#M70060</link>
      <description>&lt;UL&gt;&lt;LI&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="389851" data-lia-user-login="LiborK" class="lia-mention lia-mention-user"&gt;LiborK&lt;/a&gt;&amp;nbsp;ok, then my measure should work. Show me the fields you put on the buckets and also the result of them and of my measure. If you get an error in my measure, please verify that all the column names and measures are correct&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Mon, 16 May 2022 11:52:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Running-Total/m-p/2517426#M70060</guid>
      <dc:creator>SpartaBI</dc:creator>
      <dc:date>2022-05-16T11:52:03Z</dc:date>
    </item>
    <item>
      <title>Re: Running Total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Running-Total/m-p/2520098#M70208</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="389851" data-lia-user-login="LiborK" class="lia-mention lia-mention-user"&gt;LiborK&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may try this solution.&lt;/P&gt;
&lt;P&gt;Here are the Measures created.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Count ID = CALCULATE(COUNT('Table'[ID]),ALLEXCEPT('Table','Table'[ID]))

Total Count of IDs = CALCULATE(COUNT('Table'[ID]),ALL('Table'))

%ID = DIVIDE([Count ID],'Table'[Total Count of IDs])

Wished Running Sum = CALCULATE([%ID],FILTER(ALL('Table'),'Table'[RANK]&amp;gt;=MAX('Table'[RANK])))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here are the Calculated columns created.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;DistinctCountID =CALCULATE(COUNT('Table'[ID]),FILTER(ALL('Table'),'Table'[ID]=EARLIER('Table'[ID])))

RANK =
VAR MaxID =
    CALCULATE ( MAX ( 'Table'[ID] ), ALLEXCEPT ( 'Table', 'Table'[DistinctCountID] ) )
VAR Addition =
    ROUND ( 'Table'[%ID], 5 ) * 100000
RETURN
    IF ( 'Table'[ID] &amp;lt; MaxID, Addition + MaxID, Addition )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then, the result look 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;Also, attach the pbix file as reference.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider&lt;STRONG&gt; Accept it as the solution&lt;/STRONG&gt; to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Community Support Team _ Caiyun&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2022 01:08:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Running-Total/m-p/2520098#M70208</guid>
      <dc:creator>v-cazheng-msft</dc:creator>
      <dc:date>2022-05-18T01:08:05Z</dc:date>
    </item>
    <item>
      <title>Re: Running Total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Running-Total/m-p/2520128#M70211</link>
      <description>&lt;P&gt;It works thank you so much!&lt;/P&gt;</description>
      <pubDate>Tue, 17 May 2022 10:05:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Running-Total/m-p/2520128#M70211</guid>
      <dc:creator>LiborK</dc:creator>
      <dc:date>2022-05-17T10:05:43Z</dc:date>
    </item>
  </channel>
</rss>

