<?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 first values for multiple categories in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-of-first-values-for-multiple-categories/m-p/2935025#M96663</link>
    <description>&lt;P&gt;Hey sorry I just noticed something. This measure ignores the data that isn't available at MAX(Date). Some clients only have data until middle of the month so this measure seems to ignore those that are not available at the MAX(Date). Is there a way we can get the latest date instead ?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 29 Nov 2022 08:30:59 GMT</pubDate>
    <dc:creator>Velvetine27</dc:creator>
    <dc:date>2022-11-29T08:30:59Z</dc:date>
    <item>
      <title>Sum of first values for multiple categories</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-of-first-values-for-multiple-categories/m-p/2931492#M96443</link>
      <description>&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Im looking for a way to get the sum of values for these :&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Client&lt;/TD&gt;&lt;TD&gt;Material&lt;/TD&gt;&lt;TD&gt;Date&lt;/TD&gt;&lt;TD&gt;Value&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;ABC&lt;/TD&gt;&lt;TD&gt;101&lt;/TD&gt;&lt;TD&gt;12/1/2022&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;ABC&lt;/TD&gt;&lt;TD&gt;102&lt;/TD&gt;&lt;TD&gt;13/1/2022&lt;/TD&gt;&lt;TD&gt;20&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;ABC&lt;/TD&gt;&lt;TD&gt;101&lt;/TD&gt;&lt;TD&gt;13/1/2022&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;ABC&lt;/TD&gt;&lt;TD&gt;103&lt;/TD&gt;&lt;TD&gt;13/1/2022&lt;/TD&gt;&lt;TD&gt;30&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way for me to get the average value for each clients and sum it all ? Do note that there are tons of other clients with similar condition. Ideally it should take only from the latest date and average it but it works without latest date as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance !&lt;/P&gt;</description>
      <pubDate>Sun, 27 Nov 2022 23:30:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-of-first-values-for-multiple-categories/m-p/2931492#M96443</guid>
      <dc:creator>Velvetine27</dc:creator>
      <dc:date>2022-11-27T23:30:35Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of first values for multiple categories</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-of-first-values-for-multiple-categories/m-p/2931567#M96448</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;sum of the average normally doesn't make any sense. what is the purpose?&lt;/P&gt;&lt;P&gt;And&amp;nbsp;what does this mean "&lt;SPAN&gt;works without latest date as well&lt;/SPAN&gt;"?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2022 01:50:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-of-first-values-for-multiple-categories/m-p/2931567#M96448</guid>
      <dc:creator>FreemanZ</dc:creator>
      <dc:date>2022-11-28T01:50:58Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of first values for multiple categories</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-of-first-values-for-multiple-categories/m-p/2931573#M96450</link>
      <description>&lt;P&gt;The idea is that we are looking for Value for Client. And the Value for Client is the average for all the Values of Materials under the Client. Thus why I'm looking for the Average to get the Client's value. But at the same time I need to sum all of the Average Values for all Clients.&lt;BR /&gt;&lt;BR /&gt;The Date by right it should take only the latest date of the month. But if we average the value for entire month I assume it wouldnt affect much the Average Value in the end. Sorry if my explanation doesn't make sense.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2022 02:04:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-of-first-values-for-multiple-categories/m-p/2931573#M96450</guid>
      <dc:creator>Velvetine27</dc:creator>
      <dc:date>2022-11-28T02:04:37Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of first values for multiple categories</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-of-first-values-for-multiple-categories/m-p/2931734#M96461</link>
      <description>&lt;P&gt;average over multiple monthly ends?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;would suggest your provide more data, so the advisor could verify the proposed solution.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2022 03:31:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-of-first-values-for-multiple-categories/m-p/2931734#M96461</guid>
      <dc:creator>FreemanZ</dc:creator>
      <dc:date>2022-11-28T03:31:50Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of first values for multiple categories</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-of-first-values-for-multiple-categories/m-p/2931794#M96465</link>
      <description>&lt;P&gt;Yes, the aggregation should take the final date. So if we display monthly data it should provide latest monthly data for each Client.&amp;nbsp;&lt;/P&gt;&lt;TABLE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&gt;&lt;TD&gt;60&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;Will this sample data be enough ? The calculation should take :&amp;nbsp;&lt;BR /&gt;for ABC, latest date 25/1/2022 = (10 + 30) / 2&amp;nbsp;&lt;BR /&gt;for BCD, latest date 24/1/2022 = (50 + 60) / 2&lt;BR /&gt;final value = 20 + 55&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2022 04:16:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-of-first-values-for-multiple-categories/m-p/2931794#M96465</guid>
      <dc:creator>Velvetine27</dc:creator>
      <dc:date>2022-11-28T04:16:13Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of first values for multiple categories</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-of-first-values-for-multiple-categories/m-p/2932094#M96485</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="472535" data-lia-user-login="Velvetine27" class="lia-mention lia-mention-user"&gt;Velvetine27&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&lt;SUP&gt;&amp;nbsp;&lt;/SUP&gt;&lt;/P&gt;
&lt;P&gt;Is this what you want to achieve, calculate the sum and average of the corresponding ones based on the latest date and clients&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;The following are the relevant measure codes&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Sum_value = SUMX(FILTER(ALL('Table'),'Table'[Client]=SELECTEDVALUE('Table'[Client])&amp;amp;&amp;amp;'Table'[Date]=SELECTEDVALUE('Table'[Date])),'Table'[Value])&lt;/P&gt;
&lt;P&gt;&lt;SUP&gt;&amp;nbsp;&lt;/SUP&gt;&lt;/P&gt;
&lt;P&gt;Avg_value = AVERAGEX(FILTER(ALL('Table'),'Table'[Client]=SELECTEDVALUE('Table'[Client])&amp;amp;&amp;amp;'Table'[Date]=SELECTEDVALUE('Table'[Date])),[Value])&lt;/P&gt;
&lt;P&gt;&lt;SUP&gt;&amp;nbsp;&lt;/SUP&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SUP&gt;Best Regards,&lt;/SUP&gt;&lt;/P&gt;
&lt;P&gt;&lt;SUP&gt;Yolo Zhu&lt;/SUP&gt;&lt;/P&gt;
&lt;P&gt;&lt;SUP&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;/SUP&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2022 07:31:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-of-first-values-for-multiple-categories/m-p/2932094#M96485</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-11-28T07:31:44Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of first values for multiple categories</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-of-first-values-for-multiple-categories/m-p/2933061#M96538</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="472535" data-lia-user-login="Velvetine27" class="lia-mention lia-mention-user"&gt;Velvetine27&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;try to create a measure with the code below:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ValueSum = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt;&lt;SPAN&gt; table1 =&lt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;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TableName[Client],&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TableName[Date]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt;&lt;SPAN&gt; RESULT =&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SUMX&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;VALUES&lt;/SPAN&gt;&lt;SPAN&gt;(TableName[Client]),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;AVERAGEX&lt;/SPAN&gt;&lt;SPAN&gt;(Table2, TableName[Value])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;SPAN&gt; Result&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I tried and it worked like this:&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>Mon, 28 Nov 2022 13:42:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-of-first-values-for-multiple-categories/m-p/2933061#M96538</guid>
      <dc:creator>FreemanZ</dc:creator>
      <dc:date>2022-11-28T13:42:56Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of first values for multiple categories</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-of-first-values-for-multiple-categories/m-p/2934140#M96621</link>
      <description>&lt;P&gt;wew this is the first time i see TREATAS. It works perfectly ! thank you for the solution and knowledge imparted.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Nov 2022 01:29:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-of-first-values-for-multiple-categories/m-p/2934140#M96621</guid>
      <dc:creator>Velvetine27</dc:creator>
      <dc:date>2022-11-29T01:29:53Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of first values for multiple categories</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-of-first-values-for-multiple-categories/m-p/2934295#M96623</link>
      <description>&lt;P&gt;With ADDCOLUMNS, we build intermediate tables with expected granularity, but the data lineage is broken. TREATAS serves to rewire the relationship with the original table.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Nov 2022 02:49:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-of-first-values-for-multiple-categories/m-p/2934295#M96623</guid>
      <dc:creator>FreemanZ</dc:creator>
      <dc:date>2022-11-29T02:49:22Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of first values for multiple categories</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-of-first-values-for-multiple-categories/m-p/2935025#M96663</link>
      <description>&lt;P&gt;Hey sorry I just noticed something. This measure ignores the data that isn't available at MAX(Date). Some clients only have data until middle of the month so this measure seems to ignore those that are not available at the MAX(Date). Is there a way we can get the latest date instead ?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Nov 2022 08:30:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-of-first-values-for-multiple-categories/m-p/2935025#M96663</guid>
      <dc:creator>Velvetine27</dc:creator>
      <dc:date>2022-11-29T08:30:59Z</dc:date>
    </item>
    <item>
      <title>Re: Sum of first values for multiple categories</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-of-first-values-for-multiple-categories/m-p/2935241#M96681</link>
      <description>&lt;P&gt;the MAX(Date) is inside ADDCOLUMNS, calculated based on the row context from VALUES([Client]), so this shall not be an issue. Could you say more about the issue?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Nov 2022 09:19:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-of-first-values-for-multiple-categories/m-p/2935241#M96681</guid>
      <dc:creator>FreemanZ</dc:creator>
      <dc:date>2022-11-29T09:19:55Z</dc:date>
    </item>
  </channel>
</rss>

