<?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: Total of Total Column in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-of-Total-Column/m-p/1308397#M22784</link>
    <description>&lt;P&gt;Thanks, but it didn't work.&lt;/P&gt;</description>
    <pubDate>Wed, 19 Aug 2020 17:55:33 GMT</pubDate>
    <dc:creator>Euto</dc:creator>
    <dc:date>2020-08-19T17:55:33Z</dc:date>
    <item>
      <title>Total of Total Column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-of-Total-Column/m-p/1308246#M22772</link>
      <description>&lt;P&gt;This is a sample data&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is what I am getting = $1,300 with&amp;nbsp; "&lt;SPAN&gt;AVERAGE(DanSampleData[Rent])"&lt;/SPAN&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;This is what I am expecting =&amp;nbsp;$1,291&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Please how do I contruct my dax ?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried the following avgrent1 to avgrent6 with no luck.&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;MyTotal = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;// Varibles&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var Countofrows = CALCULATE(DISTINCTCOUNT(DanSampleData[Building]), ALL(DanSampleData))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var Agvrent = CALCULATE(AVERAGE(DanSampleData[Rent]), ALL(DanSampleData))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;// Attempts&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var avgrent1 = AVERAGE(DanSampleData[Rent])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;var avgrent2 = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;IF(HASONEVALUE(DanSampleData[Building]),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;avgrent1,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;SUMX(VALUES(DanSampleData[Building]), avgrent1)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;var avgrent3 = CALCULATE(DIVIDE(Agvrent, Countofrows, 0), ALL(DanSampleData[Building]))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;var avgrent4 = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;AVERAGE(DanSampleData[Rent]),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ALLEXCEPT(DanSampleData, DanSampleData[Building], DanSampleData[Units])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;var avgrent5 = AVERAGEX(DanSampleData, DanSampleData[Rent])&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;var avgrent6 = AVERAGEX(VALUES(DanSampleData[Building]), AVERAGE(DanSampleData[Rent]))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;avgrent6&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 19 Aug 2020 17:33:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-of-Total-Column/m-p/1308246#M22772</guid>
      <dc:creator>Euto</dc:creator>
      <dc:date>2020-08-19T17:33:57Z</dc:date>
    </item>
    <item>
      <title>Re: Total of Total Column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-of-Total-Column/m-p/1308295#M22777</link>
      <description>&lt;P&gt;Instead of AVERAGE try using AVERAGEX&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 17:10:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-of-Total-Column/m-p/1308295#M22777</guid>
      <dc:creator>AlejandroAldama</dc:creator>
      <dc:date>2020-08-19T17:10:22Z</dc:date>
    </item>
    <item>
      <title>Re: Total of Total Column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-of-Total-Column/m-p/1308302#M22778</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="245271" data-lia-user-login="Euto" class="lia-mention lia-mention-user"&gt;Euto&lt;/a&gt; , Try like &lt;/P&gt;
&lt;P&gt;AVERAGEX(values(Table[Building]),AVERAGE(DanSampleData[Rent]))&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 17:14:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-of-Total-Column/m-p/1308302#M22778</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2020-08-19T17:14:04Z</dc:date>
    </item>
    <item>
      <title>Re: Total of Total Column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-of-Total-Column/m-p/1308397#M22784</link>
      <description>&lt;P&gt;Thanks, but it didn't work.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 17:55:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-of-Total-Column/m-p/1308397#M22784</guid>
      <dc:creator>Euto</dc:creator>
      <dc:date>2020-08-19T17:55:33Z</dc:date>
    </item>
    <item>
      <title>Re: Total of Total Column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-of-Total-Column/m-p/1308487#M22787</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="245271" data-lia-user-login="Euto" class="lia-mention lia-mention-user"&gt;Euto&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this measure&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;avg rent =
SWITCH (
    TRUE (),
    NOT (
        ISINSCOPE ( 'Table'[Building] )
    )
        &amp;amp;&amp;amp; NOT (
            ISINSCOPE ( 'Table'[Unit] )
        ), SUMX (
        VALUES ( 'Table'[Building] ),
        DIVIDE (
            CALCULATE (
                AVERAGE ( 'Table'[Price] )
            ),
            DISTINCTCOUNT ( 'Table'[Building] )
        )
    ),
    ISINSCOPE ( 'Table'[Unit] ), AVERAGE ( 'Table'[Price] ),
    ISINSCOPE ( 'Table'[Building] ), AVERAGE ( 'Table'[Price] )
)
&lt;/LI-CODE&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;
&lt;P&gt;Regards,&lt;BR /&gt;Harsh Nathani&lt;BR /&gt;&lt;STRONG&gt;Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 18:53:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-of-Total-Column/m-p/1308487#M22787</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-08-19T18:53:19Z</dc:date>
    </item>
    <item>
      <title>Re: Total of Total Column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-of-Total-Column/m-p/1308518#M22793</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp;this worked like magic! Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I sasid "magic" lol because I am not able to understand what this measure is doing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can this be simplified? or further explained ?. I would appriciate. Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 19:08:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-of-Total-Column/m-p/1308518#M22793</guid>
      <dc:creator>Euto</dc:creator>
      <dc:date>2020-08-19T19:08:36Z</dc:date>
    </item>
    <item>
      <title>Re: Total of Total Column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-of-Total-Column/m-p/1308527#M22795</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="245271" data-lia-user-login="Euto" class="lia-mention lia-mention-user"&gt;Euto&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Understanding of ISINSCOPE is the crux here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.youtube.com/watch?v=sSUCyps_1O4" target="_blank"&gt;https://www.youtube.com/watch?v=sSUCyps_1O4&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;BR /&gt;Harsh Nathani&lt;BR /&gt;&lt;STRONG&gt;Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 19:13:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-of-Total-Column/m-p/1308527#M22795</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-08-19T19:13:48Z</dc:date>
    </item>
    <item>
      <title>Re: Total of Total Column</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-of-Total-Column/m-p/1308663#M22797</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp;I am sorry, I may have to uncheck your solution as the solution. I will provide the &lt;STRONG&gt;solution&lt;/STRONG&gt; and &lt;STRONG&gt;explain&lt;/STRONG&gt;&amp;nbsp;further below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Solution&lt;/STRONG&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;LI-CODE lang="markup"&gt;MyTotal = 
var vTable = VALUES('DanSampleData'[Building])
var bldCount = DISTINCTCOUNT('DanSampleData'[Building])
RETURN
SUMX (vTable,
    DIVIDE(
        CALCULATE(
            AVERAGE('DanSampleData'[Rent])),
            bldCount)
)&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;STRONG&gt;IMAGE OF SOLUTION APPLIED&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Explanation&lt;BR /&gt;&lt;/STRONG&gt;Your solution above did give me the expected result, but the construct of the DAX was overkill. It would not realy help someone&amp;nbsp; or someone else to use this solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I debugged the DAX you provided into several stages using variables.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;Stage 1&lt;/STRONG&gt;&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;MyTotal = 

var _Value1 = NOT (ISINSCOPE ( 'DanSampleData'[Building]))&amp;amp;&amp;amp; NOT (ISINSCOPE ( 'Table'[Unit] ))
var _Result1 = SUMX (VALUES ( 'DanSampleData'[Building] ),DIVIDE (CALCULATE (AVERAGE ( 'DanSampleData'[Rent] )),DISTINCTCOUNT ( 'DanSampleData'[Building] )))
var _Value2 = ISINSCOPE ( 'DanSampleData'[Rent] )
var _Result2 = AVERAGE ( 'DanSampleData'[Rent] )
var _Value3 = ISINSCOPE ( 'DanSampleData'[Building] )
var _Result3 = AVERAGE ( 'DanSampleData'[Rent] )

var Final =
SWITCH (TRUE ()
,_Value1, _Result1
,_Value2, _Result3
,_Value3, _Result3
)

RETURN
Final&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In stage 1, with the Dax above, I realized that returning only the _Result1 give me the expected outcome, and I did not need to use the "ISINSCOPE" and "SWTITCH" funtions.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Which means the result is&amp;nbsp;&lt;/P&gt;&lt;P&gt;MyTotal = SUMX (VALUES ( 'DanSampleData'[Building] ),DIVIDE (CALCULATE (AVERAGE ( 'DanSampleData'[Rent] )),DISTINCTCOUNT ( 'DanSampleData'[Building] )))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Stage 2&lt;/STRONG&gt;&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;MyTotal = 
var vTable = VALUES('DanSampleData'[Building])
var bldCount = DISTINCTCOUNT('DanSampleData'[Building])
RETURN
SUMX (vTable,
    DIVIDE(
        CALCULATE(
            AVERAGE('DanSampleData'[Rent])),
            bldCount)
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In Stage 2, with the dax above it's much easier to see what&amp;nbsp; is been calculated. Even with this I still have some observations and questions&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- &lt;STRONG&gt;Observation&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;1. Using "CALCULATE(AVERAGE('DanSampleData'[Rent]))" in my RETURN works, but using "AVERAGE('DanSampleData'[Rent])" did not work.&lt;/P&gt;&lt;P&gt;2. Using&amp;nbsp;"CALCULATE(AVERAGE('DanSampleData'[Rent]))"&amp;nbsp;in variable like "avgTable = CALCULATE(AVERAGE('DanSampleData'[Rent]))" and then calling the variable in my return does not work. Which is why i did not use variable here.&lt;/P&gt;&lt;P&gt;- &lt;STRONG&gt;Questions&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1. What is the different between "CALCULATE(AVERAGE('DanSampleData'[Rent]))" and "AVERAGE('DanSampleData'[Rent])" ?&amp;nbsp;&lt;/STRONG&gt;&lt;EM&gt;note that no filter is been applied to the Calculate function&lt;BR /&gt;&lt;/EM&gt;&lt;STRONG&gt;2. Why does it not work when is use "CALCULATE(AVERAGE('DanSampleData'[Rent]))" in variable like "avgTable = CALCULATE(AVERAGE('DanSampleData'[Rent]))" ?&lt;/STRONG&gt;&lt;EM&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 20:47:12 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Total-of-Total-Column/m-p/1308663#M22797</guid>
      <dc:creator>Euto</dc:creator>
      <dc:date>2020-08-19T20:47:12Z</dc:date>
    </item>
  </channel>
</rss>

