<?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 DAX Switch statement not providing totals value in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Switch-statement-not-providing-totals-value/m-p/4416356#M175364</link>
    <description>&lt;P&gt;I have a dax switch statement that produces the correct numbers inside the table, but I am not able to get it to sum the column into a grand total. I attempted using a sumx statement, however it doesn't seem to produce a different result. Oddly, if I separate it into 2 measures, then it does show the total. What is the best practice to sum this column and keep its respective filters?&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;Switch Value = 
VAR CALC1 = 
SWITCH(
    TRUE(),
    MAX(dimensionValues[Department Number]) IN {"029", "032"}, CALCULATE(SUM(generalLedgerEntries[amount]) * -1, generalLedgerAccounts[accountNumber] = "4700"),
    MAX(dimensionValues[Department Number]) IN {"030", "031", "036"}, CALCULATE(SUM(generalLedgerEntries[amount]) * -1, generalLedgerAccounts[accountNumber] IN {"4700","4701"}),
    MAX(dimensionValues[Department Number]) IN {"038"}, CALCULATE(SUM(generalLedgerEntries[amount]) * -1, generalLedgerAccounts[accountNumber] IN {"4700"}),
    MAX(dimensionValues[Department Number]) IN {"039"}, CALCULATE(SUM(generalLedgerEntries[amount]) * -1, generalLedgerAccounts[accountNumber] IN {"4700"}),
    MAX(dimensionValues[Department Number]) IN {"000", "033"}, CALCULATE(SUM(generalLedgerEntries[amount]) * -1, generalLedgerAccounts[accountNumber] &amp;gt;= "4604" &amp;amp;&amp;amp; generalLedgerAccounts[accountNumber] &amp;lt;= "4610" || generalLedgerAccounts[accountNumber] IN {"4615"}),
    BLANK()
)

VAR CALC2 =
SUMX(
    VALUES(dimensionValues[Department Name]), CALC1
)

RETURN CALC2&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;P&gt;Result it produces (Blank Total)&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 18 Feb 2025 19:36:09 GMT</pubDate>
    <dc:creator>DCrone</dc:creator>
    <dc:date>2025-02-18T19:36:09Z</dc:date>
    <item>
      <title>DAX Switch statement not providing totals value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Switch-statement-not-providing-totals-value/m-p/4416356#M175364</link>
      <description>&lt;P&gt;I have a dax switch statement that produces the correct numbers inside the table, but I am not able to get it to sum the column into a grand total. I attempted using a sumx statement, however it doesn't seem to produce a different result. Oddly, if I separate it into 2 measures, then it does show the total. What is the best practice to sum this column and keep its respective filters?&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;Switch Value = 
VAR CALC1 = 
SWITCH(
    TRUE(),
    MAX(dimensionValues[Department Number]) IN {"029", "032"}, CALCULATE(SUM(generalLedgerEntries[amount]) * -1, generalLedgerAccounts[accountNumber] = "4700"),
    MAX(dimensionValues[Department Number]) IN {"030", "031", "036"}, CALCULATE(SUM(generalLedgerEntries[amount]) * -1, generalLedgerAccounts[accountNumber] IN {"4700","4701"}),
    MAX(dimensionValues[Department Number]) IN {"038"}, CALCULATE(SUM(generalLedgerEntries[amount]) * -1, generalLedgerAccounts[accountNumber] IN {"4700"}),
    MAX(dimensionValues[Department Number]) IN {"039"}, CALCULATE(SUM(generalLedgerEntries[amount]) * -1, generalLedgerAccounts[accountNumber] IN {"4700"}),
    MAX(dimensionValues[Department Number]) IN {"000", "033"}, CALCULATE(SUM(generalLedgerEntries[amount]) * -1, generalLedgerAccounts[accountNumber] &amp;gt;= "4604" &amp;amp;&amp;amp; generalLedgerAccounts[accountNumber] &amp;lt;= "4610" || generalLedgerAccounts[accountNumber] IN {"4615"}),
    BLANK()
)

VAR CALC2 =
SUMX(
    VALUES(dimensionValues[Department Name]), CALC1
)

RETURN CALC2&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;P&gt;Result it produces (Blank Total)&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Feb 2025 19:36:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Switch-statement-not-providing-totals-value/m-p/4416356#M175364</guid>
      <dc:creator>DCrone</dc:creator>
      <dc:date>2025-02-18T19:36:09Z</dc:date>
    </item>
    <item>
      <title>Re: DAX Switch statement not providing totals value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Switch-statement-not-providing-totals-value/m-p/4416700#M175381</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="846092" data-lia-user-login="DCrone" class="lia-mention lia-mention-user"&gt;DCrone&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please try this. If below DAX doesn't work, please provide sample data or pbix file(exclude sensitive data).&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Switch Value = 
SUMX(
    VALUES(dimensionValues[Department Name]), CALCULATE(SWITCH(
    TRUE(),
    MAX(dimensionValues[Department Number]) IN {"029", "032"}, CALCULATE(SUM(generalLedgerEntries[amount]) * -1, generalLedgerAccounts[accountNumber] = "4700"),
    MAX(dimensionValues[Department Number]) IN {"030", "031", "036"}, CALCULATE(SUM(generalLedgerEntries[amount]) * -1, generalLedgerAccounts[accountNumber] IN {"4700","4701"}),
    MAX(dimensionValues[Department Number]) IN {"038"}, CALCULATE(SUM(generalLedgerEntries[amount]) * -1, generalLedgerAccounts[accountNumber] IN {"4700"}),
    MAX(dimensionValues[Department Number]) IN {"039"}, CALCULATE(SUM(generalLedgerEntries[amount]) * -1, generalLedgerAccounts[accountNumber] IN {"4700"}),
    MAX(dimensionValues[Department Number]) IN {"000", "033"}, CALCULATE(SUM(generalLedgerEntries[amount]) * -1, generalLedgerAccounts[accountNumber] &amp;gt;= "4604" &amp;amp;&amp;amp; generalLedgerAccounts[accountNumber] &amp;lt;= "4610" || generalLedgerAccounts[accountNumber] IN {"4615"}),
    BLANK()
))
)
&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;P&gt;——————————————————————————————————————————————————&lt;/P&gt;
&lt;P&gt;&lt;I&gt;If my answer helps you solve the problem,&amp;nbsp;please accept my answer as a solution and let it be seen by more people in need.&lt;/I&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;I&gt;Best regards,&lt;/I&gt;&lt;/P&gt;
&lt;P&gt;&lt;I&gt;Mengmeng Li&lt;/I&gt;&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2025 01:52:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Switch-statement-not-providing-totals-value/m-p/4416700#M175381</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2025-02-19T01:52:50Z</dc:date>
    </item>
    <item>
      <title>Re: DAX Switch statement not providing totals value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Switch-statement-not-providing-totals-value/m-p/4420122#M175493</link>
      <description>&lt;P&gt;I appreciate it. This was the correct solution I was looking for!&lt;/P&gt;</description>
      <pubDate>Thu, 20 Feb 2025 15:58:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-Switch-statement-not-providing-totals-value/m-p/4420122#M175493</guid>
      <dc:creator>DCrone</dc:creator>
      <dc:date>2025-02-20T15:58:44Z</dc:date>
    </item>
  </channel>
</rss>

