<?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 Total Is Correct but row is not when using ALL in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-Is-Correct-but-row-is-not-when-using-ALL/m-p/4354168#M172884</link>
    <description>&lt;P&gt;Biggest puzzler yet:&amp;nbsp; I have this measure called [%Need].&amp;nbsp; The sum total of these percentages needs to be 1 in order to compute correctly.&amp;nbsp; However, it's not, so in order to correct it I need to do a formula like:&amp;nbsp; [%Need]/Sum [%Need] *1.&amp;nbsp; So in order to get sum portion&amp;nbsp; I did:&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;CALCULATE(SUMX(VALUES('Calendar'[calendar date]),[%Need]),ALL('Calendar'[CalendarDate]))&lt;/LI-CODE&gt;&lt;P&gt;This puts 1(I checked it out to 15 0s 1.00000000000000 in each row instead of the correct amount which is 1.0147.&amp;nbsp; 1.0147 however appears in the Total at the bottom.&amp;nbsp; I need 1.0147 in each row so I can have it divided by [%Need].&amp;nbsp; &amp;nbsp; This probably doesn't need to be included, but just in case the [%Need] measure is:&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;IF([CALendarDATE]&amp;gt;LASTNONBLANK ( 'Calendar'[Calendar Date], [Gross Adds]),[PYGA]/([PYALLGAs]-[GAsLyMAXDateAll]),Blank())&lt;/LI-CODE&gt;&lt;P&gt;Any idea how to get the correct total in each row?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 08 Jan 2025 01:18:10 GMT</pubDate>
    <dc:creator>BrianNeedsHelp</dc:creator>
    <dc:date>2025-01-08T01:18:10Z</dc:date>
    <item>
      <title>Total Is Correct but row is not when using ALL</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-Is-Correct-but-row-is-not-when-using-ALL/m-p/4354168#M172884</link>
      <description>&lt;P&gt;Biggest puzzler yet:&amp;nbsp; I have this measure called [%Need].&amp;nbsp; The sum total of these percentages needs to be 1 in order to compute correctly.&amp;nbsp; However, it's not, so in order to correct it I need to do a formula like:&amp;nbsp; [%Need]/Sum [%Need] *1.&amp;nbsp; So in order to get sum portion&amp;nbsp; I did:&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;CALCULATE(SUMX(VALUES('Calendar'[calendar date]),[%Need]),ALL('Calendar'[CalendarDate]))&lt;/LI-CODE&gt;&lt;P&gt;This puts 1(I checked it out to 15 0s 1.00000000000000 in each row instead of the correct amount which is 1.0147.&amp;nbsp; 1.0147 however appears in the Total at the bottom.&amp;nbsp; I need 1.0147 in each row so I can have it divided by [%Need].&amp;nbsp; &amp;nbsp; This probably doesn't need to be included, but just in case the [%Need] measure is:&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;IF([CALendarDATE]&amp;gt;LASTNONBLANK ( 'Calendar'[Calendar Date], [Gross Adds]),[PYGA]/([PYALLGAs]-[GAsLyMAXDateAll]),Blank())&lt;/LI-CODE&gt;&lt;P&gt;Any idea how to get the correct total in each row?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jan 2025 01:18:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-Is-Correct-but-row-is-not-when-using-ALL/m-p/4354168#M172884</guid>
      <dc:creator>BrianNeedsHelp</dc:creator>
      <dc:date>2025-01-08T01:18:10Z</dc:date>
    </item>
    <item>
      <title>Re: Total Is Correct but row is not when using ALL</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-Is-Correct-but-row-is-not-when-using-ALL/m-p/4354215#M172886</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="828752" data-lia-user-login="BrianNeedsHelp" class="lia-mention lia-mention-user"&gt;BrianNeedsHelp&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;The issue arises because DAX treats row context and filter context differently when calculating totals versus individual rows. Here's a breakdown of what's happening and how to fix it:&lt;/P&gt;&lt;H3&gt;Problem:&lt;/H3&gt;&lt;OL&gt;&lt;LI&gt;The total row correctly shows &lt;STRONG&gt;1.0147&lt;/STRONG&gt;, but individual rows incorrectly show &lt;STRONG&gt;1.0000&lt;/STRONG&gt;.&lt;/LI&gt;&lt;LI&gt;This is because you're using ALL('Calendar'[CalendarDate]), which removes the filter context for the column. This causes the calculation to consider all dates, not just the rows' specific contexts.&lt;/LI&gt;&lt;/OL&gt;&lt;H3&gt;Solution:&lt;/H3&gt;&lt;P&gt;You want each row to reflect the correct percentage by dividing the row's %Need value by the sum total (1.0147). To achieve this:&lt;/P&gt;&lt;H4&gt;Corrected Measure&lt;/H4&gt;&lt;PRE&gt;[%Need Adjusted] =
VAR TotalNeed =
    CALCULATE(SUMX(VALUES('Calendar'[Calendar Date]), [%Need]), ALL('Calendar'))
RETURN
    DIVIDE([%Need], TotalNeed)&lt;/PRE&gt;&lt;H3&gt;Why This Works:&lt;/H3&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;CALCULATE with ALL&lt;/STRONG&gt;:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The ALL function removes all filters on the Calendar table, ensuring that the total sum of %Need is calculated across the entire dataset.&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Row-Level Context&lt;/STRONG&gt;:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Within each row, %Need is calculated based on the current filter context.&lt;/LI&gt;&lt;LI&gt;The TotalNeed variable ensures you're dividing each row's %Need by the same total value.&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;DIVIDE for Safety&lt;/STRONG&gt;:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Using DIVIDE avoids division-by-zero errors and is best practice for these scenarios.&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;H3&gt;Debugging and Validation&lt;/H3&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;Add a temporary measure to verify the TotalNeed:&lt;/P&gt;&lt;PRE&gt;TotalNeed = CALCULATE(SUMX(VALUES('Calendar'[Calendar Date]), [%Need]), ALL('Calendar'))&lt;/PRE&gt;&lt;P&gt;This should return &lt;STRONG&gt;1.0147&lt;/STRONG&gt; consistently across all rows.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Test the %Need Adjusted measure in your table visual.&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Let me know if this resolves the issue or if you need further clarification!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Please mark this as solution if it helps you. Appreciate Kudos&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jan 2025 01:58:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-Is-Correct-but-row-is-not-when-using-ALL/m-p/4354215#M172886</guid>
      <dc:creator>FarhanJeelani</dc:creator>
      <dc:date>2025-01-08T01:58:34Z</dc:date>
    </item>
    <item>
      <title>Re: Total Is Correct but row is not when using ALL</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-Is-Correct-but-row-is-not-when-using-ALL/m-p/4354331#M172889</link>
      <description>&lt;P&gt;Thanks for your reply and explanation.&amp;nbsp; However that measure does the same thing.&amp;nbsp; 1 in all the rows and 1.0147 in the total.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jan 2025 03:16:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-Is-Correct-but-row-is-not-when-using-ALL/m-p/4354331#M172889</guid>
      <dc:creator>BrianNeedsHelp</dc:creator>
      <dc:date>2025-01-08T03:16:45Z</dc:date>
    </item>
  </channel>
</rss>

