<?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: The running total doesn't count same values? Why :( in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/The-running-total-doesn-t-count-same-values-Why/m-p/3363109#M126450</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="591285" data-lia-user-login="Yiyi" class="lia-mention lia-mention-user"&gt;Yiyi&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suggest you to try code as below to create a measure.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Pareto =
VAR Total_Unique_Item =
    CALCULATE ( DISTINCTCOUNT ( Data[HeadlineID] ), ALLSELECTED ( Data ) )
VAR Current_Total_Unique_Item =
    DISTINCTCOUNT ( Data[HeadlineID] )
VAR SummarizedTable =
    SUMMARIZE (
        ALLSELECTED ( Data ),
        Data[Media],
        "Unique_Item_Count", DISTINCTCOUNT ( Data[HeadlineID] )
    )
VAR ADDRANK =
    ADDCOLUMNS (
        SummarizedTable,
        "RANK",
            RANKX ( SummarizedTable, [Unique_Item_Count],, DESC, SKIP )
                + IF (
                    COUNTX (
                        FILTER (
                            SummarizedTable,
                            [Unique_Item_Count] = EARLIER ( [Unique_Item_Count] )
                        ),
                        [Unique_Item_Count]
                    ) &amp;gt; 1,
                    RANKX (
                        FILTER (
                            SummarizedTable,
                            [Unique_Item_Count] = EARLIER ( [Unique_Item_Count] )
                        ),
                        [Media],
                        ,
                        ASC,
                        DENSE
                    ) - 1
                )
    )
VAR CumulativeSum =
    SUMX (
        FILTER (
            ADDRANK,
            [RANK]
                &amp;lt;= SUMX ( FILTER ( ADDRANK, [Media] = MAX ( Data[Media] ) ), [RANK] )
        ),
        [Unique_Item_Count]
    )
RETURN
    CumulativeSum / Total_Unique_Item&lt;/LI-CODE&gt;
&lt;P&gt;Result is as below.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Rico Zhou&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&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>Thu, 03 Aug 2023 07:10:34 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2023-08-03T07:10:34Z</dc:date>
    <item>
      <title>The running total doesn't count same values? Why :(</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/The-running-total-doesn-t-count-same-values-Why/m-p/3359229#M126277</link>
      <description>&lt;P&gt;Hello all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new to DAX and I tried to calculate the running total for the variable of media so I can see how many media counts for 80% of all the item creation.&amp;nbsp;The result is problematic as the rows with the same values were not cumulated:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;My Dax is as follows:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Pareto =
VAR Total_Unique_Item =
   CALCULATE(
   DISTINCTCOUNT(Data[HeadlineID]),
   ALLSELECTED(Data)
    )
VAR Current_Total_Unique_Item = DISTINCTCOUNT(Data[HeadlineID])
VAR SummarizedTable =
   SUMMARIZE(
   ALLSELECTED(Data),
   Data[Media],
   "Unique_Item_Count", DISTINCTCOUNT(Data[HeadlineID])
)
VAR CumulativeSum =
   SUMX (
   FILTER(SummarizedTable, [Unique_Item_Count] &amp;gt;= Current_Total_Unique_Item),
   [Unique_Item_Count])
RETURN
CumulativeSum/Total_Unique_Item&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I really appreciate if you could help! Thanks!&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 01 Aug 2023 11:09:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/The-running-total-doesn-t-count-same-values-Why/m-p/3359229#M126277</guid>
      <dc:creator>Yiyi</dc:creator>
      <dc:date>2023-08-01T11:09:04Z</dc:date>
    </item>
    <item>
      <title>Re: The running total doesn't count same values? Why :(</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/The-running-total-doesn-t-count-same-values-Why/m-p/3363109#M126450</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="591285" data-lia-user-login="Yiyi" class="lia-mention lia-mention-user"&gt;Yiyi&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suggest you to try code as below to create a measure.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Pareto =
VAR Total_Unique_Item =
    CALCULATE ( DISTINCTCOUNT ( Data[HeadlineID] ), ALLSELECTED ( Data ) )
VAR Current_Total_Unique_Item =
    DISTINCTCOUNT ( Data[HeadlineID] )
VAR SummarizedTable =
    SUMMARIZE (
        ALLSELECTED ( Data ),
        Data[Media],
        "Unique_Item_Count", DISTINCTCOUNT ( Data[HeadlineID] )
    )
VAR ADDRANK =
    ADDCOLUMNS (
        SummarizedTable,
        "RANK",
            RANKX ( SummarizedTable, [Unique_Item_Count],, DESC, SKIP )
                + IF (
                    COUNTX (
                        FILTER (
                            SummarizedTable,
                            [Unique_Item_Count] = EARLIER ( [Unique_Item_Count] )
                        ),
                        [Unique_Item_Count]
                    ) &amp;gt; 1,
                    RANKX (
                        FILTER (
                            SummarizedTable,
                            [Unique_Item_Count] = EARLIER ( [Unique_Item_Count] )
                        ),
                        [Media],
                        ,
                        ASC,
                        DENSE
                    ) - 1
                )
    )
VAR CumulativeSum =
    SUMX (
        FILTER (
            ADDRANK,
            [RANK]
                &amp;lt;= SUMX ( FILTER ( ADDRANK, [Media] = MAX ( Data[Media] ) ), [RANK] )
        ),
        [Unique_Item_Count]
    )
RETURN
    CumulativeSum / Total_Unique_Item&lt;/LI-CODE&gt;
&lt;P&gt;Result is as below.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Rico Zhou&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&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>Thu, 03 Aug 2023 07:10:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/The-running-total-doesn-t-count-same-values-Why/m-p/3363109#M126450</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-08-03T07:10:34Z</dc:date>
    </item>
    <item>
      <title>Re: The running total doesn't count same values? Why :(</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/The-running-total-doesn-t-count-same-values-Why/m-p/3363508#M126462</link>
      <description>&lt;P&gt;Super cool! It works, thanks a lot!&lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2023 10:49:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/The-running-total-doesn-t-count-same-values-Why/m-p/3363508#M126462</guid>
      <dc:creator>Yiyi</dc:creator>
      <dc:date>2023-08-03T10:49:41Z</dc:date>
    </item>
    <item>
      <title>Re: The running total doesn't count same values? Why :(</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/The-running-total-doesn-t-count-same-values-Why/m-p/3363542#M126465</link>
      <description>&lt;P&gt;Hello Rico,&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you may still have some time, I would like to ask if it is possible to calculate the number of media accounting for 80% of all the items built on the code you provided.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;VAR Pareto = CumulativeSum / Total_Unique_Item 
VAR ROW_COUNT_80 = CALCULATE(COUNTROWS(SummarizedTable), FILTER( SummarizedTable, pareto &amp;lt; 0.8)) 
RETURN ROW_COUNT_80&lt;/LI-CODE&gt;&lt;P&gt;I tried to add those below your code, but the number is a constant number (total amount of media). Can you kindly tell what is wrong here?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2023 11:18:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/The-running-total-doesn-t-count-same-values-Why/m-p/3363542#M126465</guid>
      <dc:creator>Yiyi</dc:creator>
      <dc:date>2023-08-03T11:18:38Z</dc:date>
    </item>
  </channel>
</rss>

