<?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: Matrix Grand Total - Summing the Row Averages in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Matrix-Grand-Total-Summing-the-Row-Averages/m-p/3969391#M153952</link>
    <description>&lt;P&gt;Here is a link to a test power BI dashboard with the data added in. Hopefully that will help out.&lt;BR /&gt;&lt;A href="https://claycorp-my.sharepoint.com/:u:/p/meyerry/EQXxWw6vX3hNiz3X4onL_0QBXECjR-cwQ6wGcPMF_nGjoQ?e=nNlUsE" target="_blank"&gt;TestData.pbix&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 03 Jun 2024 17:12:56 GMT</pubDate>
    <dc:creator>MeyerRy</dc:creator>
    <dc:date>2024-06-03T17:12:56Z</dc:date>
    <item>
      <title>Matrix Grand Total - Summing the Row Averages</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Matrix-Grand-Total-Summing-the-Row-Averages/m-p/3969323#M153947</link>
      <description>&lt;P&gt;I need help getting a measure to sum the row totals for the grand total value. The measure below produces the following output. The grand total box is taking averaging the 3 column totals (highlighted in yellow). I want the grand total to sum the row totals (highlighted in green). How can I accomplish this?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Test2 =&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;AVERAGEX&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;(&lt;/SPAN&gt;&lt;SPAN&gt;EstimateSummaryDataDetails&lt;/SPAN&gt;&lt;SPAN&gt;[EstimateName]&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;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;CostUnpivot&lt;/SPAN&gt;&lt;SPAN&gt;[TotalCost]&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&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>Tue, 04 Jun 2024 13:10:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Matrix-Grand-Total-Summing-the-Row-Averages/m-p/3969323#M153947</guid>
      <dc:creator>MeyerRy</dc:creator>
      <dc:date>2024-06-04T13:10:41Z</dc:date>
    </item>
    <item>
      <title>Re: Matrix Grand Total - Summing the Row Averages</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Matrix-Grand-Total-Summing-the-Row-Averages/m-p/3969391#M153952</link>
      <description>&lt;P&gt;Here is a link to a test power BI dashboard with the data added in. Hopefully that will help out.&lt;BR /&gt;&lt;A href="https://claycorp-my.sharepoint.com/:u:/p/meyerry/EQXxWw6vX3hNiz3X4onL_0QBXECjR-cwQ6wGcPMF_nGjoQ?e=nNlUsE" target="_blank"&gt;TestData.pbix&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jun 2024 17:12:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Matrix-Grand-Total-Summing-the-Row-Averages/m-p/3969391#M153952</guid>
      <dc:creator>MeyerRy</dc:creator>
      <dc:date>2024-06-03T17:12:56Z</dc:date>
    </item>
    <item>
      <title>Re: Matrix Grand Total - Summing the Row Averages</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Matrix-Grand-Total-Summing-the-Row-Averages/m-p/3970127#M153978</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="740203" data-lia-user-login="MeyerRy" class="lia-mention lia-mention-user"&gt;MeyerRy&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I create a table as you mentioned.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Then I create two measures and here are the DAX codes.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Column = SUMX('Table','Table'[A]+'Table'[B]+'Table'[C])/3&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Row =
(
    MAX ( 'Table'[A] ) + MAX ( 'Table'[B] )
        + MAX ( 'Table'[C] )
)
    / (
        COUNT ( 'Table'[A] ) + COUNT ( 'Table'[B] )
            + COUNT ( 'Table'[C] )
    )&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Finally I create a measure and get what you want.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Column+Row = 'Table'[Column]+'Table'[Row]&lt;/LI-CODE&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;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin-bottom: 6.0pt;"&gt;&lt;SPAN&gt;Best Regards&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 6.0pt;"&gt;&lt;SPAN&gt;Yilong Zhou&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin-bottom: 6.0pt;"&gt;&lt;SPAN&gt;If this post&amp;nbsp;&lt;STRONG&gt;&lt;I&gt;helps&lt;/I&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;I&gt;Accept it as the solution&lt;/I&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2024 03:17:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Matrix-Grand-Total-Summing-the-Row-Averages/m-p/3970127#M153978</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-06-04T03:17:36Z</dc:date>
    </item>
    <item>
      <title>Re: Matrix Grand Total - Summing the Row Averages</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Matrix-Grand-Total-Summing-the-Row-Averages/m-p/3971514#M154014</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp;Interesting formulas. Unfornataly the $88.56 M is not the number I was looking for. If you add up all the row totals the grand total should be&amp;nbsp;$89,389,186.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2024 13:17:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Matrix-Grand-Total-Summing-the-Row-Averages/m-p/3971514#M154014</guid>
      <dc:creator>MeyerRy</dc:creator>
      <dc:date>2024-06-04T13:17:27Z</dc:date>
    </item>
    <item>
      <title>Re: Matrix Grand Total - Summing the Row Averages</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Matrix-Grand-Total-Summing-the-Row-Averages/m-p/3972157#M154032</link>
      <description>&lt;P&gt;I managed to get a working measure based on the help from&amp;nbsp;Anonymous&lt;/a&gt;. You helped point me in the right direction. The following measure will give me the answer I was looking for but what I failed to anticapte was if I changed the cost breakdown structure (the rows on the left) to a different one that had more blanks in the data. The Grand Total cost will change. Which technically is doing what I wanted but from a user standpoint the Grand Total cost changing will immediatdly cause distrust with the data.&amp;nbsp; What I am going to end up doing is just taking the total cost of each row and dividing by number of projects to get the average cost. That is a much easier measure to create. I am not sure if this will help others in the future but here is the measure:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Total Cost with Grand Total Summing Matrix Row Totals = 
VAR RowTotal = 
    SUMX(
        SUMMARIZE(
            'Table',
            'Table'[CBSValue],
            "@TotalCost",
                SUMX(
                    FILTER(
                        'Table',
                        'Table'[CBSValue] = EARLIER('Table'[CBSValue])
                    ),
                    IF(NOT(ISBLANK('Table'[TotalCost])), 'Table'[TotalCost], BLANK())
                )
        ),
        [@TotalCost]
    )
VAR NonBlankCount = 
    SUMX(
        SUMMARIZE(
            'Table',
            'Table'[CBSValue],
            "@Count",
                COUNTX(
                    FILTER(
                        'Table',
                        'Table'[CBSValue] = EARLIER('Table'[CBSValue])
                    ),
                    IF(NOT(ISBLANK('Table'[TotalCost])), 'Table'[TotalCost], BLANK())
                )
        ),
        [@Count]
    )
VAR RowAverage = 
    DIVIDE(RowTotal, NonBlankCount, 0) -- Divide by NonBlankCount, if it is 0 then use 0 as default
RETURN
IF(
    ISINSCOPE('Table'[CBSValue]), 
    RowAverage,
    SUMX(
        SUMMARIZE(
            'Table',
            'Table'[CBSValue],
            "@RowTotal",
                SUMX(
                    FILTER(
                        'Table',
                        'Table'[CBSValue] = EARLIER('Table'[CBSValue])
                    ),
                    IF(NOT(ISBLANK('Table'[TotalCost])), 'Table'[TotalCost], BLANK())
                ),
            "@NonBlankCount",
                COUNTX(
                    FILTER(
                        'Table',
                        'Table'[CBSValue] = EARLIER('Table'[CBSValue])
                    ),
                    IF(NOT(ISBLANK('Table'[TotalCost])), 'Table'[TotalCost], BLANK())
                )
        ),
        DIVIDE([@RowTotal], [@NonBlankCount], 0)
    )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2024 17:47:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Matrix-Grand-Total-Summing-the-Row-Averages/m-p/3972157#M154032</guid>
      <dc:creator>MeyerRy</dc:creator>
      <dc:date>2024-06-04T17:47:46Z</dc:date>
    </item>
  </channel>
</rss>

