<?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 Custom Total having Sum and Sumproduct in Matix in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Custom-Total-having-Sum-and-Sumproduct-in-Matix/m-p/1882798#M40480</link>
    <description>&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope you are well. I have a requirment in which I have a few KPIs/measures in a Matrix. I want to apply a custom total in the end of my Matrix but this custom total should apply Sum function for a few KPIs/measures and Sumproduct on other KPIs/measure. Below is the sample:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Product 1&lt;/TD&gt;&lt;TD&gt;Product 2&lt;/TD&gt;&lt;TD&gt;Product 3&lt;/TD&gt;&lt;TD&gt;Custom Total&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Sale&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;TD&gt;30&lt;/TD&gt;&lt;TD&gt;Sum&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Production&lt;/TD&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;TD&gt;22&lt;/TD&gt;&lt;TD&gt;40&lt;/TD&gt;&lt;TD&gt;Sum&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Discount&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;Sumproduct&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Cost&lt;/TD&gt;&lt;TD&gt;500&lt;/TD&gt;&lt;TD&gt;600&lt;/TD&gt;&lt;TD&gt;700&lt;/TD&gt;&lt;TD&gt;Sumproduct&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Profit&lt;/TD&gt;&lt;TD&gt;1200&lt;/TD&gt;&lt;TD&gt;1500&lt;/TD&gt;&lt;TD&gt;1600&lt;/TD&gt;&lt;TD&gt;Sumproduct&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to achieve this? Thanks!&lt;BR /&gt;&lt;BR /&gt;TA&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 04 Jun 2021 18:24:02 GMT</pubDate>
    <dc:creator>ashrat001</dc:creator>
    <dc:date>2021-06-04T18:24:02Z</dc:date>
    <item>
      <title>Custom Total having Sum and Sumproduct in Matix</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Custom-Total-having-Sum-and-Sumproduct-in-Matix/m-p/1882798#M40480</link>
      <description>&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope you are well. I have a requirment in which I have a few KPIs/measures in a Matrix. I want to apply a custom total in the end of my Matrix but this custom total should apply Sum function for a few KPIs/measures and Sumproduct on other KPIs/measure. Below is the sample:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;Product 1&lt;/TD&gt;&lt;TD&gt;Product 2&lt;/TD&gt;&lt;TD&gt;Product 3&lt;/TD&gt;&lt;TD&gt;Custom Total&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Sale&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;TD&gt;15&lt;/TD&gt;&lt;TD&gt;30&lt;/TD&gt;&lt;TD&gt;Sum&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Production&lt;/TD&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;TD&gt;22&lt;/TD&gt;&lt;TD&gt;40&lt;/TD&gt;&lt;TD&gt;Sum&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Discount&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;Sumproduct&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Cost&lt;/TD&gt;&lt;TD&gt;500&lt;/TD&gt;&lt;TD&gt;600&lt;/TD&gt;&lt;TD&gt;700&lt;/TD&gt;&lt;TD&gt;Sumproduct&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Profit&lt;/TD&gt;&lt;TD&gt;1200&lt;/TD&gt;&lt;TD&gt;1500&lt;/TD&gt;&lt;TD&gt;1600&lt;/TD&gt;&lt;TD&gt;Sumproduct&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to achieve this? Thanks!&lt;BR /&gt;&lt;BR /&gt;TA&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jun 2021 18:24:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Custom-Total-having-Sum-and-Sumproduct-in-Matix/m-p/1882798#M40480</guid>
      <dc:creator>ashrat001</dc:creator>
      <dc:date>2021-06-04T18:24:02Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Total having Sum and Sumproduct in Matix</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Custom-Total-having-Sum-and-Sumproduct-in-Matix/m-p/1883185#M40498</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="267904" data-lia-user-login="ashrat001" class="lia-mention lia-mention-user"&gt;ashrat001&lt;/a&gt;&amp;nbsp;please try this:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Special =
VAR _totsum =
    SUMX ( myTable, myTable[Product 1] + myTable[Product 2] + myTable[Product 3] )
VAR _totSumProduct =
    PRODUCTX ( myTable, [Product 1] * myTable[Product 2] * myTable[Product 3] )
RETURN
    IF (
        MAX ( myTable[TYPE] ) = "Production"
            || MAX ( myTable[TYPE] ) = "Sale",
        _totsum,
        _totSumProduct
    )
&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;BR /&gt;Let me know if you have any questions.&lt;BR /&gt;&lt;BR /&gt;If this solves your issues, please mark it as the &lt;STRONG&gt;solution, &lt;/STRONG&gt;so that others can find it easily. &lt;STRONG&gt;Kudos &lt;/STRONG&gt;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;are nice too.&lt;BR /&gt;Nathaniel&lt;/P&gt;</description>
      <pubDate>Sat, 05 Jun 2021 05:15:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Custom-Total-having-Sum-and-Sumproduct-in-Matix/m-p/1883185#M40498</guid>
      <dc:creator>Nathaniel_C</dc:creator>
      <dc:date>2021-06-05T05:15:24Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Total having Sum and Sumproduct in Matix</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Custom-Total-having-Sum-and-Sumproduct-in-Matix/m-p/1883244#M40505</link>
      <description>&lt;P&gt;Hi Nathaniel,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your reply. Maybe you did not get the requiremt. Actually, in the column I have a dimension namely variant having different products name and in the value section I have different measures which I need to sum and do the productsum. Please is the screen shot of my matrix having actuall data. For measure Production and Sales I need to sum these and other measures like NSI, Cost of Blend, Efficiency Loss and Other Chemicals I need to apply Sumproduction on these using measures Production and Sales.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I did not get your Dax.&amp;nbsp;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I want this Special Total at the end of the Matrix. Thanks!&lt;BR /&gt;&lt;BR /&gt;TA&lt;/P&gt;</description>
      <pubDate>Sat, 05 Jun 2021 08:31:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Custom-Total-having-Sum-and-Sumproduct-in-Matix/m-p/1883244#M40505</guid>
      <dc:creator>ashrat001</dc:creator>
      <dc:date>2021-06-05T08:31:59Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Total having Sum and Sumproduct in Matix</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Custom-Total-having-Sum-and-Sumproduct-in-Matix/m-p/1883427#M40526</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="267904" data-lia-user-login="ashrat001" class="lia-mention lia-mention-user"&gt;ashrat001&lt;/a&gt;&amp;nbsp;, edited measure for you:&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;SumProduct vs Sum = 

var _totalSum = SUMX(myTable,myTable[Product 1]+myTable[Product 2]+myTable[Product 3])  

var _totSumProduct = Sumx( myTable,[Product 1]*myTable[Product 2]*myTable[Product 3])

var _iterate = IF(MAX(myTable[TYPE])="Production" || MAX(myTable[TYPE])="Sale",_totalSum,_totSumProduct)

return sumx( myTable,_iterate)

================================================

Final measure = 

var _mycolumn = ADDCOLUMNS(myTable,"ColSum",[SumProduct vs Sum])

var _sumcolumn = SUMX(_mycolumn,[SumProduct vs Sum])

return _sumcolumn
&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;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;Let me know if you have any questions.&lt;BR /&gt;&lt;BR /&gt;If this solves your issues, please mark it as the &lt;STRONG&gt;solution, &lt;/STRONG&gt;so that others can find it easily. &lt;STRONG&gt;Kudos &lt;/STRONG&gt;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;are nice too.&lt;BR /&gt;Nathaniel&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 05 Jun 2021 17:15:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Custom-Total-having-Sum-and-Sumproduct-in-Matix/m-p/1883427#M40526</guid>
      <dc:creator>Nathaniel_C</dc:creator>
      <dc:date>2021-06-05T17:15:28Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Total having Sum and Sumproduct in Matix</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Custom-Total-having-Sum-and-Sumproduct-in-Matix/m-p/1883706#M40541</link>
      <description>&lt;P&gt;Hi Nathaniel,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;See below your suggested Dax it is not working properly. I've faced an error.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SumProduct vs Sum = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;var totalSum = sumx('Merged Queries','Merged Queries'[Variant.Variant Level 01])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var totSumProduct = Sumx( 'Merged Queries','Merged Queries'[Variant.Variant Level 01] * 'Merged Queries'[Variant.Variant Level 01])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;var iterate = IF(MAX('Merged Queries'[Fibre Production Tons])="Production" || MAX('Merged Queries'[Sales Volume Tons])="Sale",totalSum,totSumProduct)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;return sumx('Merged Queries',iterate)&lt;BR /&gt;&lt;BR /&gt;I do not understand the [Product 1] + [Product 2]&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;What are you summing in the above epressison. Product 1 and Product 2 are the values of the dimension variant not a measure.&lt;BR /&gt;Secondly, [Product 1] * [Product 2]&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;Following is the formula for Sumproduct&amp;nbsp;&lt;BR /&gt;SUMPRODUCT(D20:X20,D10:X10)/AB10)&lt;BR /&gt;Multiplying the each value of the Cost with Production for the specific Variant value (Product) and then dividing by total of the Production.&lt;BR /&gt;&lt;BR /&gt;I would appreciate your assistance. Thanks&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Sun, 06 Jun 2021 08:44:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Custom-Total-having-Sum-and-Sumproduct-in-Matix/m-p/1883706#M40541</guid>
      <dc:creator>ashrat001</dc:creator>
      <dc:date>2021-06-06T08:44:38Z</dc:date>
    </item>
  </channel>
</rss>

