<?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 Sumx not giving correct total in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sumx-not-giving-correct-total/m-p/2255502#M54433</link>
    <description>&lt;P&gt;Hi ,&lt;BR /&gt;&lt;BR /&gt;I am getting the incorrect subcategory total.&lt;BR /&gt;e.g:-FSSD + COLA = 0.24 but coming 0.56. then JNS + Dairy =0.03 but coming 0.04&lt;BR /&gt;My correct sub category totals to form correct Total .&lt;BR /&gt;&lt;BR /&gt;My file:-&amp;nbsp;&lt;A href="https://www.dropbox.com/s/4q6scqcfot9uj1k/totalerrror.pbix?dl=0" target="_blank"&gt;https://www.dropbox.com/s/4q6scqcfot9uj1k/totalerrror.pbix?dl=0&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Its urgent , please help&lt;BR /&gt;&lt;img /&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 24 Dec 2021 18:04:06 GMT</pubDate>
    <dc:creator>souvik900766</dc:creator>
    <dc:date>2021-12-24T18:04:06Z</dc:date>
    <item>
      <title>Sumx not giving correct total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sumx-not-giving-correct-total/m-p/2255502#M54433</link>
      <description>&lt;P&gt;Hi ,&lt;BR /&gt;&lt;BR /&gt;I am getting the incorrect subcategory total.&lt;BR /&gt;e.g:-FSSD + COLA = 0.24 but coming 0.56. then JNS + Dairy =0.03 but coming 0.04&lt;BR /&gt;My correct sub category totals to form correct Total .&lt;BR /&gt;&lt;BR /&gt;My file:-&amp;nbsp;&lt;A href="https://www.dropbox.com/s/4q6scqcfot9uj1k/totalerrror.pbix?dl=0" target="_blank"&gt;https://www.dropbox.com/s/4q6scqcfot9uj1k/totalerrror.pbix?dl=0&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Its urgent , please help&lt;BR /&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Dec 2021 18:04:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sumx-not-giving-correct-total/m-p/2255502#M54433</guid>
      <dc:creator>souvik900766</dc:creator>
      <dc:date>2021-12-24T18:04:06Z</dc:date>
    </item>
    <item>
      <title>Re: Sumx not giving correct total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sumx-not-giving-correct-total/m-p/2255522#M54434</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="218999" data-lia-user-login="souvik900766" class="lia-mention lia-mention-user"&gt;souvik900766&lt;/a&gt;&amp;nbsp;Try MM3TR&amp;amp;R:&amp;nbsp;&lt;A href="https://community.powerbi.com/t5/Quick-Measures-Gallery/Matrix-Measure-Total-Triple-Threat-Rock-amp-Roll/m-p/411443#M150" target="_blank"&gt;Matrix Measure Total Triple Threat Rock &amp;amp; Roll - Microsoft Power BI Community&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Dec 2021 19:03:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sumx-not-giving-correct-total/m-p/2255522#M54434</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2021-12-24T19:03:44Z</dc:date>
    </item>
    <item>
      <title>Re: Sumx not giving correct total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sumx-not-giving-correct-total/m-p/2255578#M54435</link>
      <description>&lt;P&gt;Your [Mix Impact] measure is complex but the issue is the typical subtotaling issue.&lt;/P&gt;
&lt;LI-CODE lang="php"&gt;Mix Impact =
VAR IndustryRNARTDBaseCY = [CY Ind RNARTD]
VAR IndustryRNARTDBasePY = [PY Ind RNARTD]
VAR INDRNARTD =
    SUMX (
        VALUES ( Category[Category to be used] ),
        (
            DIVIDE ( [CY Ind], IndustryRNARTDBaseCY )
                - DIVIDE ( [PY Ind], IndustryRNARTDBasePY )
        ) * 100 * [PY Value Share Withhin OU]
    )
VAR IndustryRNARTDCOLABaseCY = [CY Ind RNARTD]
VAR IndustryRNARTDCOLABasePY = [PY Ind RNARTD]
VAR IndRNARTDCOLA =
    SUMX (
        VALUES ( 'Category'[Category to be used] ),
        (
            DIVIDE ( [CY Ind COLA], IndustryRNARTDCOLABaseCY )
                - DIVIDE ( [PY Ind COLA], IndustryRNARTDCOLABasePY )
        ) * 100 * [PY Value Share Withhin OU Cola]
    )
VAR IndustryRNARTDFSSDBaseCY = [CY Ind RNARTD]
VAR IndustryRNARTDFSSDBasePY = [PY Ind RNARTD]
VAR IndRNARTDFSSD =
    SUMX (
        VALUES ( 'Category'[Category to be used] ),
        (
            DIVIDE ( [CY Ind FSSD], IndustryRNARTDFSSDBaseCY )
                - DIVIDE ( [PY Ind FSSD], IndustryRNARTDFSSDBasePY )
        ) * 100 * [PY Value Share Withhin OU Mixed]
    )
RETURN
    SWITCH (
        TRUE (),
        SELECTEDVALUE ( Category[Category to be used] ) = "SSD Cola (Within SSD Cola)", IndRNARTDCOLA,
        SELECTEDVALUE ( Category[Category to be used] ) = "SSD Cola (Within SSD)", "",
        SELECTEDVALUE ( Category[Category to be used] ) = "FSSD (Within SSD Non-Cola)", IndRNARTDFSSD,
        SELECTEDVALUE ( Category[Category to be used] ) = "FSSD (Within SSD)", "",
        INDRNARTD
    )
&lt;/LI-CODE&gt;
&lt;P&gt;For totals including more than one category, it always returns the INDRNARTD default option from the SWITCH.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The standard solution is to iterate over the granularity that you want to sum at. That is,&lt;/P&gt;
&lt;LI-CODE lang="php"&gt;SUMX (
    VALUES ( Category[Category to be used] ),
    [Mix Impact]
)&lt;/LI-CODE&gt;
&lt;P&gt;However, this may not work for the same reason you had issues previously. I.e., you'd have the ALLSELECTED functions from [CY/PY Ind RNARTD] inside of an iterator.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not making any guarantees that this will work but you might be able to refactor the measure along these lines:&lt;/P&gt;
&lt;LI-CODE lang="php"&gt;Mix Impact =
VAR IndustryRNARTDBaseCY = [CY Ind RNARTD]
VAR IndustryRNARTDBasePY = [PY Ind RNARTD]
VAR IndustryRNARTDCOLABaseCY = [CY Ind RNARTD]
VAR IndustryRNARTDCOLABasePY = [PY Ind RNARTD]
VAR IndustryRNARTDFSSDBaseCY = [CY Ind RNARTD]
VAR IndustryRNARTDFSSDBasePY = [PY Ind RNARTD]
RETURN
    SUMX (
        VALUES ( Category[Category to be used] ),
        SWITCH (
            Category[Category to be used],
            "SSD Cola (Within SSD Cola)",
                (
                    DIVIDE ( [CY Ind COLA], IndustryRNARTDCOLABaseCY ) -
                    DIVIDE ( [PY Ind COLA], IndustryRNARTDCOLABasePY )
                ) * 100 * [PY Value Share Withhin OU Cola],
            "FSSD (Within SSD)", "",
            "FSSD (Within SSD Non-Cola)",
                (
                    DIVIDE ( [CY Ind FSSD], IndustryRNARTDFSSDBaseCY ) -
                    DIVIDE ( [PY Ind FSSD], IndustryRNARTDFSSDBasePY )
                ) * 100 * [PY Value Share Withhin OU Mixed],
            "SSD Cola (Within SSD)", "",
            (
                DIVIDE ( [CY Ind], IndustryRNARTDBaseCY ) -
                DIVIDE ( [PY Ind], IndustryRNARTDBasePY )
            ) * 100 * [PY Value Share Withhin OU]
        )
    )&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 24 Dec 2021 22:50:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sumx-not-giving-correct-total/m-p/2255578#M54435</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2021-12-24T22:50:50Z</dc:date>
    </item>
    <item>
      <title>Re: Sumx not giving correct total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sumx-not-giving-correct-total/m-p/2257790#M54541</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="39298" data-lia-user-login="AlexisOlson" class="lia-mention lia-mention-user"&gt;AlexisOlson&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;Thanks a ton for the help !&lt;BR /&gt;It worked perfectly with&amp;nbsp;&lt;SPAN&gt;guarantee !&lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Dec 2021 06:10:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sumx-not-giving-correct-total/m-p/2257790#M54541</guid>
      <dc:creator>souvik900766</dc:creator>
      <dc:date>2021-12-28T06:10:02Z</dc:date>
    </item>
  </channel>
</rss>

