<?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: Sum of the Sum in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-of-the-Sum/m-p/3605170#M139286</link>
    <description>&lt;P&gt;Certainly! Based on your description, you want to calculate the sum of values where the status is "y" but only for the latest version.&lt;/P&gt;&lt;P&gt;To achieve this, you can make use of the FILTER function along with the MAX function. Here's how you can modify your DAX measure to get the desired result:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;.TotalValue_StatusY =&lt;BR /&gt;VAR MaxVersion = CALCULATE(MAX('Table'[Version]), 'Table'[Status] = "y")&lt;BR /&gt;RETURN&lt;BR /&gt;CALCULATE(&lt;BR /&gt;SUM('Table'[Value]),&lt;BR /&gt;'Table'[Status] = "y",&lt;BR /&gt;'Table'[Version] = MaxVersion&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's a breakdown of what's happening in the measure:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;We first calculate the maximum version number where the status is "y" using the CALCULATE and MAX functions and store it in the variable MaxVersion.&lt;/LI&gt;&lt;LI&gt;Then, using the CALCULATE function again, we filter the table to only consider rows where the status is "y" and the version matches the MaxVersion. Finally, we sum up the values for these filtered rows.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;By using this measure, you should get the sum of values for the latest version where the status is "y".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If this post&amp;nbsp;helps, then please consider&amp;nbsp;Accepting it as the solution&amp;nbsp;to help the other members find it more quickly.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;In case there is still a problem, please feel free and explain your issue in detail,&amp;nbsp;It will be my pleasure to assist you in any way I can.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 28 Dec 2023 10:04:18 GMT</pubDate>
    <dc:creator>123abc</dc:creator>
    <dc:date>2023-12-28T10:04:18Z</dc:date>
    <item>
      <title>Sum of the Sum</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-of-the-Sum/m-p/3605163#M139285</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope find you well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a problem.&amp;nbsp;&lt;BR /&gt;To have the sum per line I used the measure:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;.TotalValue&lt;/SPAN&gt;&lt;SPAN&gt;_StatusY =&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Table&lt;/SPAN&gt;&lt;SPAN&gt;[Value]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;'Table'&lt;/SPAN&gt;&lt;SPAN&gt;[Status]&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;"y"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;'Table'&lt;/SPAN&gt;&lt;SPAN&gt;[Version]&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;MAX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Table'&lt;/SPAN&gt;&lt;SPAN&gt;[Version]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;But at the total level I have the sum of all values with status "y" when my purpose is to have only the sum of the latest version of status "y".&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Can you help me?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Example:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 28 Dec 2023 10:01:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-of-the-Sum/m-p/3605163#M139285</guid>
      <dc:creator>sara_pinto15</dc:creator>
      <dc:date>2023-12-28T10:01:19Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of the Sum</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-of-the-Sum/m-p/3605170#M139286</link>
      <description>&lt;P&gt;Certainly! Based on your description, you want to calculate the sum of values where the status is "y" but only for the latest version.&lt;/P&gt;&lt;P&gt;To achieve this, you can make use of the FILTER function along with the MAX function. Here's how you can modify your DAX measure to get the desired result:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;.TotalValue_StatusY =&lt;BR /&gt;VAR MaxVersion = CALCULATE(MAX('Table'[Version]), 'Table'[Status] = "y")&lt;BR /&gt;RETURN&lt;BR /&gt;CALCULATE(&lt;BR /&gt;SUM('Table'[Value]),&lt;BR /&gt;'Table'[Status] = "y",&lt;BR /&gt;'Table'[Version] = MaxVersion&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's a breakdown of what's happening in the measure:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;We first calculate the maximum version number where the status is "y" using the CALCULATE and MAX functions and store it in the variable MaxVersion.&lt;/LI&gt;&lt;LI&gt;Then, using the CALCULATE function again, we filter the table to only consider rows where the status is "y" and the version matches the MaxVersion. Finally, we sum up the values for these filtered rows.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;By using this measure, you should get the sum of values for the latest version where the status is "y".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If this post&amp;nbsp;helps, then please consider&amp;nbsp;Accepting it as the solution&amp;nbsp;to help the other members find it more quickly.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;In case there is still a problem, please feel free and explain your issue in detail,&amp;nbsp;It will be my pleasure to assist you in any way I can.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Dec 2023 10:04:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-of-the-Sum/m-p/3605170#M139286</guid>
      <dc:creator>123abc</dc:creator>
      <dc:date>2023-12-28T10:04:18Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of the Sum</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-of-the-Sum/m-p/3605604#M139298</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;TotalValue_StatusY =
    SUMX(VALUES(Table[ID]),
	CALCULATE(SUM('Table'[Value]),
    		'Table'[Status]="y",
    		'Table'[Version]=MAX('Table'[Version])))&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 28 Dec 2023 14:01:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-of-the-Sum/m-p/3605604#M139298</guid>
      <dc:creator>sjoerdvn</dc:creator>
      <dc:date>2023-12-28T14:01:16Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of the Sum</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-of-the-Sum/m-p/3605944#M139305</link>
      <description>&lt;P&gt;hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="460979" data-lia-user-login="sara_pinto15" class="lia-mention lia-mention-user"&gt;sara_pinto15&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="460979" data-lia-user-login="sara_pinto15" class="lia-mention lia-mention-user"&gt;sara_pinto15&lt;/a&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;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;measure =
   SUMX(
      FILTER(
        'Table','Table'[version ] =CALCULATE(MAX('Table'[version]), 
         'Table'[status]="y",ALLEXCEPT('Table','Table'[id]))
      ),
   'Table'[value]
   )&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;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Dec 2023 09:27:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-of-the-Sum/m-p/3605944#M139305</guid>
      <dc:creator>Dangar332</dc:creator>
      <dc:date>2023-12-29T09:27:13Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of the Sum</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-of-the-Sum/m-p/3606672#M139348</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="460979" data-lia-user-login="sara_pinto15" class="lia-mention lia-mention-user"&gt;sara_pinto15&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After understanding your problem, here is the solution I have for you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the original table data. The name of the table is Table.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Create a measure that selects the maximum version of the ID with Status being y.&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;Measure = var _maxversion=CALCULATE(max('Table'[Version]), FILTER(ALLSELECTED('Table'),'Table'[ID]=SELECTEDVALUE('Table'[ID])&amp;amp;&amp;amp;  'Table'[Status]="y"))
    return CALCULATE(sum('Table'[Value]), FILTER( 'Table' ,  'Table'[Version]=_maxversion&amp;amp;&amp;amp;'Table'[Status]="y"))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Create another measure that shows the total value of the calculation.&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;TotalValue = SUMX(VALUES('Table'[ID]),[Measure])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then the desired results can be achieved.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Erica Wu&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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Dec 2023 08:43:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-of-the-Sum/m-p/3606672#M139348</guid>
      <dc:creator>v-xiaodie-msft</dc:creator>
      <dc:date>2023-12-29T08:43:46Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of the Sum</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-of-the-Sum/m-p/3606864#M139353</link>
      <description>&lt;P&gt;This works perfectly! Thank you very much &lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Dec 2023 10:14:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-of-the-Sum/m-p/3606864#M139353</guid>
      <dc:creator>sara_pinto15</dc:creator>
      <dc:date>2023-12-29T10:14:14Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of the Sum</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-of-the-Sum/m-p/3606871#M139354</link>
      <description>&lt;P&gt;Thank you for your help.&amp;nbsp;&lt;BR /&gt;But this solution gives me this:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks anyway &lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Dec 2023 10:16:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-of-the-Sum/m-p/3606871#M139354</guid>
      <dc:creator>sara_pinto15</dc:creator>
      <dc:date>2023-12-29T10:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of the Sum</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-of-the-Sum/m-p/3606876#M139355</link>
      <description>&lt;P&gt;Thank you for your help.&amp;nbsp;&lt;BR /&gt;But this solution gives me this:&lt;BR /&gt;&lt;BR /&gt;&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;Thanks anyway&lt;SPAN&gt;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Dec 2023 10:16:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-of-the-Sum/m-p/3606876#M139355</guid>
      <dc:creator>sara_pinto15</dc:creator>
      <dc:date>2023-12-29T10:16:40Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of the Sum</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-of-the-Sum/m-p/3606880#M139356</link>
      <description>&lt;P&gt;Thank you for your help.&amp;nbsp;&lt;BR /&gt;But this solution gives me this:&lt;BR /&gt;&lt;BR /&gt;&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;Thanks anyway&lt;SPAN&gt;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Dec 2023 10:17:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-of-the-Sum/m-p/3606880#M139356</guid>
      <dc:creator>sara_pinto15</dc:creator>
      <dc:date>2023-12-29T10:17:05Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of the Sum</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-of-the-Sum/m-p/3606889#M139357</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="460979" data-lia-user-login="sara_pinto15" class="lia-mention lia-mention-user"&gt;sara_pinto15&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;with above data you provide my measure give as you want&amp;nbsp;&lt;/P&gt;&lt;P&gt;but it seems something another thing present in your real data.&lt;/P&gt;&lt;P&gt;see below screenshort&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>Fri, 29 Dec 2023 10:21:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-of-the-Sum/m-p/3606889#M139357</guid>
      <dc:creator>Dangar332</dc:creator>
      <dc:date>2023-12-29T10:21:05Z</dc:date>
    </item>
  </channel>
</rss>

