<?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: Calculate Pareto quickly in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Pareto-quickly/m-p/3938074#M153148</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="570958" data-lia-user-login="Rai_BI" class="lia-mention lia-mention-user"&gt;Rai_BI&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Measures cannot be placed on a slicer; you can create a calculated column as a slicer.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Paretto% = 
VAR vSales = [Sales Amount]
VAR vTempTable =
    ADDCOLUMNS ( ALL( 'dProducts' ), "Sales", [Sales Amount] )
VAR vSalesTotal =
    SUMX ( vTempTable, [Sales] )
RETURN
    DIVIDE(SUMX ( FILTER ( vTempTable, [Sales] &amp;gt;= vSales ), [Sales] ) ,vSalesTotal,0)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&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;Pareto Classification = 
VAR CumulativePercent = [Paretto%]
RETURN
SWITCH(TRUE(),
    CumulativePercent &amp;lt;= 0.8, "A",
    CumulativePercent &amp;lt;= 0.95, "B",
    "C"
)&lt;/LI-CODE&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;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Neeko Tang&lt;/P&gt;
&lt;P&gt;If this post  &lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider &lt;STRONG&gt;&lt;EM&gt;Accept it as the solution &lt;/EM&gt;&lt;/STRONG&gt; to help the other members find it more quickly.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 22 May 2024 05:59:08 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-05-22T05:59:08Z</dc:date>
    <item>
      <title>Calculate Pareto quickly</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Pareto-quickly/m-p/3933511#M153038</link>
      <description>&lt;P&gt;Hello friends, please can someone help me?&lt;BR /&gt;I need to create a DAX measure that calculates Pareto (80:20) of products. All the code I have written so far has resulted in failure as it exceeds available memory.&lt;/P&gt;&lt;P&gt;In my data model I have a product dimension table related to a sales fact table. The products table has 150 thousand rows and the sales table has 33 million rows. &lt;A href="https://lasdobrasilcombr-my.sharepoint.com/:u:/g/personal/rai_santos_las_app_br/EdI3a3i6NH9DsmtDUnSaNZkBkoYsR6Ktc8Kml6x-01251g?e=WChhnf" target="_self"&gt;Download an example PBIX here&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;I need a DAX measure that calculates the pareto of products, so I will be able to filter all products classified as "A" or "B" or "C". My attempts are taking 10 minutes or sometimes it doesn't load because it exceeds the available memory. I need a measurement or some technique that is quick to calculate.&lt;/P&gt;</description>
      <pubDate>Mon, 20 May 2024 21:12:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Pareto-quickly/m-p/3933511#M153038</guid>
      <dc:creator>Rai_BI</dc:creator>
      <dc:date>2024-05-20T21:12:39Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Pareto quickly</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Pareto-quickly/m-p/3934259#M153055</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="570958" data-lia-user-login="Rai_BI" class="lia-mention lia-mention-user"&gt;Rai_BI&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Through my testing, using the DIVIDE function optimizes the performance of the measure a little bit. However, due to the sheer volume of your data, I recommend filtering areas of your data and creating multiple visual objects.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Paretto% = 
VAR vSales = [Sales Amount]
VAR vTempTable =
    ADDCOLUMNS ( ALLSELECTED( 'dProducts' ), "Sales", [Sales Amount] )
VAR vSalesTotal =
    SUMX ( vTempTable, [Sales] )
RETURN
    DIVIDE(SUMX ( FILTER ( vTempTable, [Sales] &amp;gt;= vSales ), [Sales] ) ,vSalesTotal,0)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Neeko Tang&lt;/P&gt;
&lt;P&gt;If this post  &lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider &lt;EM&gt;&lt;STRONG&gt;Accept it as the solution &lt;/STRONG&gt;&lt;/EM&gt; to help the other members find it more quickly.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2024 06:11:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Pareto-quickly/m-p/3934259#M153055</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-05-21T06:11:44Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Pareto quickly</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Pareto-quickly/m-p/3935044#M153075</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="570958" data-lia-user-login="Rai_BI" class="lia-mention lia-mention-user"&gt;Rai_BI&lt;/a&gt;&amp;nbsp;- This is the measure I always use to create a pareto %&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Total Qty Pareto by Product Type = 
VAR total_qty =
    CALCULATE ( [Total Qty], ALLSELECTED ( 'Product'[Product type] ) )
VAR pareto =
    SUMX (
        WINDOW (
            0,
            ABS,
            0,
            REL,
            ALLSELECTED ( 'Product'[Product type] ),
            ORDERBY ( [Total Qty], DESC )
        ),
        [Total Qty]
    )
RETURN
    DIVIDE ( pareto, total_qty, 0 )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is usually fairly optimal. If this does not work for you, perhaps you could try a Visual Calculation, as this will only calculate for the data within your visual. It is however in preview, so there are some limitations to them.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If my measure works, I'd be grateful if you could accept it as the solution.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2024 09:51:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Pareto-quickly/m-p/3935044#M153075</guid>
      <dc:creator>mark_endicott</dc:creator>
      <dc:date>2024-05-21T09:51:38Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Pareto quickly</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Pareto-quickly/m-p/3935757#M153083</link>
      <description>&lt;P&gt;Hi!&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="343036" data-lia-user-login="mark_endicott" class="lia-mention lia-mention-user"&gt;mark_endicott&lt;/a&gt;, thank you,&lt;/P&gt;&lt;P&gt;I wrote as you said, but take a look at the print below, my&amp;nbsp;&lt;SPAN&gt;attempts&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN&gt;exceeds available memory.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2024 11:30:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Pareto-quickly/m-p/3935757#M153083</guid>
      <dc:creator>Rai_BI</dc:creator>
      <dc:date>2024-05-21T11:30:20Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Pareto quickly</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Pareto-quickly/m-p/3935865#M153085</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="570958" data-lia-user-login="Rai_BI" class="lia-mention lia-mention-user"&gt;Rai_BI&lt;/a&gt;&amp;nbsp;- That is a shame, I have also tried a Visual Calculation using your sample file and the DAX below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Pareto = 

VAR _cumulative = SUMX( WINDOW( 1, ABS, 0, REL, ROWS, ORDERBY( [Sales Amount], DESC )), [Sales Amount])
VAR _total = COLLAPSEALL( [Sales Amount], ROWS )
VAR _pareto = DIVIDE( _cumulative, _total )

RETURN
    _pareto
//    FORMAT( _pareto, "#0,0.0%")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However again this exceeds the resources when unfiltered. You will need to filter your visuals so this does not use all +50,000 of your products.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Visual Calculation will have the fastest response, but you will not be able to format the result as a % (yet, still in preview) without using FORMAT. However, when you do this it will turn the result into a string and therefore cannot be ordered.&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;</description>
      <pubDate>Tue, 21 May 2024 11:57:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Pareto-quickly/m-p/3935865#M153085</guid>
      <dc:creator>mark_endicott</dc:creator>
      <dc:date>2024-05-21T11:57:06Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Pareto quickly</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Pareto-quickly/m-p/3936031#M153086</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;, than you for your help.&lt;BR /&gt;When a filter a some products, in fact, the visual loads quickly, but how can I use this measure in a slicer for example? I was trying to create a calculated column so as i could use it in a slicer. I don´t use the filters panel.&lt;BR /&gt;&lt;BR /&gt;In slicer i need be able to filter Productos "A" or "B" or "C"&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2024 12:24:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Pareto-quickly/m-p/3936031#M153086</guid>
      <dc:creator>Rai_BI</dc:creator>
      <dc:date>2024-05-21T12:24:39Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Pareto quickly</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Pareto-quickly/m-p/3937665#M153134</link>
      <description>&lt;P&gt;&lt;A href="https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Slow-problems-when-calculating-Pareto/td-p/3917595" target="_blank"&gt;https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Slow-problems-when-calculating-Pareto/td-p/3917595&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT&gt;这个回答非常棒，他的代码3和最后一个代码4，是有不同的。类似与v-tangjie-msft 反馈的。&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2024 02:54:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Pareto-quickly/m-p/3937665#M153134</guid>
      <dc:creator>chaoat</dc:creator>
      <dc:date>2024-05-22T02:54:20Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Pareto quickly</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Pareto-quickly/m-p/3938074#M153148</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="570958" data-lia-user-login="Rai_BI" class="lia-mention lia-mention-user"&gt;Rai_BI&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Measures cannot be placed on a slicer; you can create a calculated column as a slicer.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Paretto% = 
VAR vSales = [Sales Amount]
VAR vTempTable =
    ADDCOLUMNS ( ALL( 'dProducts' ), "Sales", [Sales Amount] )
VAR vSalesTotal =
    SUMX ( vTempTable, [Sales] )
RETURN
    DIVIDE(SUMX ( FILTER ( vTempTable, [Sales] &amp;gt;= vSales ), [Sales] ) ,vSalesTotal,0)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&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;Pareto Classification = 
VAR CumulativePercent = [Paretto%]
RETURN
SWITCH(TRUE(),
    CumulativePercent &amp;lt;= 0.8, "A",
    CumulativePercent &amp;lt;= 0.95, "B",
    "C"
)&lt;/LI-CODE&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;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Neeko Tang&lt;/P&gt;
&lt;P&gt;If this post  &lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider &lt;STRONG&gt;&lt;EM&gt;Accept it as the solution &lt;/EM&gt;&lt;/STRONG&gt; to help the other members find it more quickly.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2024 05:59:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Pareto-quickly/m-p/3938074#M153148</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-05-22T05:59:08Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Pareto quickly</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Pareto-quickly/m-p/3939398#M153168</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="570958" data-lia-user-login="Rai_BI" class="lia-mention lia-mention-user"&gt;Rai_BI&lt;/a&gt;&amp;nbsp;- Now that I know you need a static analysis, your best solutuion will be to create a calculated table that does all the calculations in one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the DAX to create this table, you can change the ABC variable to suit your classifications &amp;amp; remove any unecessary columns from SELECTCOLUMNS() to remove them from the table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To input this DAX go to Modeling &amp;gt; New Table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;VAR sales_by_prod =
    SUMMARIZE (
        fSales,
        dProducts[NAME_PRODUCT],
        "Prod Amount", [Sales Amount],
        "Total amount", CALCULATE ( [Sales Amount], ALLSELECTED ( dProducts[NAME_PRODUCT] ) )
    )
VAR cumulative_prod_amount =
    ADDCOLUMNS (
        sales_by_prod,
        "Cumulative Amount",
            VAR PrdAmt = [Prod Amount]
            VAR Cumulate_amt =
                FILTER ( sales_by_prod, [Prod Amount] &amp;gt;= PrdAmt )
            RETURN
                SUMX ( Cumulate_amt, [Prod Amount] )
    )
VAR _pareto =
    ADDCOLUMNS (
        cumulative_prod_amount,
        "paretopct", DIVIDE ( [Cumulative Amount], [Total amount] )
    )
VAR ABC =
    ADDCOLUMNS (
        _pareto,
        "Pareto Classification",
            SWITCH ( TRUE (), [paretopct] &amp;lt;= 0.8, "A", [paretopct] &amp;lt;= 0.95, "B", "C" )
    )
VAR Result =
    SELECTCOLUMNS (
        ABC,
        "Product Name", dProducts[NAME_PRODUCT],
        "Sales Amount", [Sales Amount],
        "Pareto Amount", [paretopct],
        "Pareto %", FORMAT ( [paretopct], "#0.00%" ),
        "Pareto Classification", [Pareto Classification]
    )
RETURN
    Result&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This will give you a new table for analysis.&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;If this works for you, please accept it as the solution.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2024 11:01:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Pareto-quickly/m-p/3939398#M153168</guid>
      <dc:creator>mark_endicott</dc:creator>
      <dc:date>2024-05-22T11:01:30Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Pareto quickly</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Pareto-quickly/m-p/3943852#M153283</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="343036" data-lia-user-login="mark_endicott" class="lia-mention lia-mention-user"&gt;mark_endicott&lt;/a&gt;&amp;nbsp;Thank you very much !&lt;/P&gt;</description>
      <pubDate>Thu, 23 May 2024 12:16:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Pareto-quickly/m-p/3943852#M153283</guid>
      <dc:creator>Rai_BI</dc:creator>
      <dc:date>2024-05-23T12:16:12Z</dc:date>
    </item>
  </channel>
</rss>

