<?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: Show averages in subtotals/totals instead of sum for PBI pivot table in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Show-averages-in-subtotals-totals-instead-of-sum-for-PBI-pivot/m-p/2343941#M59244</link>
    <description>&lt;P&gt;Can't reach the desired result unfortunately, values are not correct&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 17 Feb 2022 06:47:13 GMT</pubDate>
    <dc:creator>dmitry-wbr</dc:creator>
    <dc:date>2022-02-17T06:47:13Z</dc:date>
    <item>
      <title>Show averages in subtotals/totals instead of sum for PBI pivot table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Show-averages-in-subtotals-totals-instead-of-sum-for-PBI-pivot/m-p/2342735#M59170</link>
      <description>&lt;P&gt;Hello everyone!&lt;BR /&gt;I've been struggling with the following problem. I have a pivot table where I calculate sum of FTE for employees with months in columns and department/employee_id in rows. Instead of sums in subtotals and totals, I want to see the averages. That's what I have right now in PBI - default aggregation with sum:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;This is my desired result. I want average aggregation for subtotals/totals across both rows and columns, while keeping sum aggregation of FTE for each employee:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I have tried DAX formulas with AVERAGEX, but it allows for average aggregation only across single dimension.&lt;BR /&gt;I will gladly appreciate any help with that one. Link for source file:&amp;nbsp;&lt;A href="https://docs.google.com/spreadsheets/d/1mWVGys7-PAUWvryvMyhyjPmmF7iSDNEE/edit?usp=sharing&amp;amp;ouid=109155426970323250863&amp;amp;rtpof=true&amp;amp;sd=true" target="_blank"&gt;https://docs.google.com/spreadsheets/d/1mWVGys7-PAUWvryvMyhyjPmmF7iSDNEE/edit?usp=sharing&amp;amp;ouid=109155426970323250863&amp;amp;rtpof=true&amp;amp;sd=true&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Feb 2022 16:13:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Show-averages-in-subtotals-totals-instead-of-sum-for-PBI-pivot/m-p/2342735#M59170</guid>
      <dc:creator>dmitry-wbr</dc:creator>
      <dc:date>2022-02-16T16:13:24Z</dc:date>
    </item>
    <item>
      <title>Re: Show averages in subtotals/totals instead of sum for PBI pivot table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Show-averages-in-subtotals-totals-instead-of-sum-for-PBI-pivot/m-p/2342863#M59175</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="296887" data-lia-user-login="dmitry-wbr" class="lia-mention lia-mention-user"&gt;dmitry-wbr&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you can use&lt;/P&gt;&lt;P&gt;IF(&lt;/P&gt;&lt;P&gt;ISINSCOPE (Table[Department] ),&lt;/P&gt;&lt;P&gt;&lt;EM&gt;"your average calculation",&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;"your sum calculation"&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Also HASONEVALUE shall retrun averages for both subtotals ans the grand total&lt;/P&gt;</description>
      <pubDate>Wed, 16 Feb 2022 17:18:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Show-averages-in-subtotals-totals-instead-of-sum-for-PBI-pivot/m-p/2342863#M59175</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-02-16T17:18:21Z</dc:date>
    </item>
    <item>
      <title>Re: Show averages in subtotals/totals instead of sum for PBI pivot table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Show-averages-in-subtotals-totals-instead-of-sum-for-PBI-pivot/m-p/2342893#M59178</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Thanks for the advice, but it doesn't seem to work &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Feb 2022 17:30:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Show-averages-in-subtotals-totals-instead-of-sum-for-PBI-pivot/m-p/2342893#M59178</guid>
      <dc:creator>dmitry-wbr</dc:creator>
      <dc:date>2022-02-16T17:30:35Z</dc:date>
    </item>
    <item>
      <title>Re: Show averages in subtotals/totals instead of sum for PBI pivot table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Show-averages-in-subtotals-totals-instead-of-sum-for-PBI-pivot/m-p/2342920#M59180</link>
      <description>&lt;P&gt;The HASONEVALUE you use it with the sub-colum (E45, M12 .....)&lt;/P&gt;&lt;P&gt;IF ( HASONEVALUE (column name), SUM, AVERAGE)&lt;/P&gt;</description>
      <pubDate>Wed, 16 Feb 2022 17:43:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Show-averages-in-subtotals-totals-instead-of-sum-for-PBI-pivot/m-p/2342920#M59180</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-02-16T17:43:56Z</dc:date>
    </item>
    <item>
      <title>Re: Show averages in subtotals/totals instead of sum for PBI pivot table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Show-averages-in-subtotals-totals-instead-of-sum-for-PBI-pivot/m-p/2343941#M59244</link>
      <description>&lt;P&gt;Can't reach the desired result unfortunately, values are not correct&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Feb 2022 06:47:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Show-averages-in-subtotals-totals-instead-of-sum-for-PBI-pivot/m-p/2343941#M59244</guid>
      <dc:creator>dmitry-wbr</dc:creator>
      <dc:date>2022-02-17T06:47:13Z</dc:date>
    </item>
    <item>
      <title>Re: Show averages in subtotals/totals instead of sum for PBI pivot table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Show-averages-in-subtotals-totals-instead-of-sum-for-PBI-pivot/m-p/2344068#M59249</link>
      <description>&lt;P&gt;This should work&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Measure2 =
IF (
    HASONEVALUE ( '12'[Employee_ID] ),
    SUM ( '12'[FTE] ),
    CALCULATE ( AVERAGE ( '12'[FTE] ), ALLSELECTED () )
)&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 17 Feb 2022 07:36:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Show-averages-in-subtotals-totals-instead-of-sum-for-PBI-pivot/m-p/2344068#M59249</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-02-17T07:36:07Z</dc:date>
    </item>
    <item>
      <title>Re: Show averages in subtotals/totals instead of sum for PBI pivot table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Show-averages-in-subtotals-totals-instead-of-sum-for-PBI-pivot/m-p/2344245#M59254</link>
      <description>&lt;P&gt;That produces the same incorrect result unfortunately&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Feb 2022 08:36:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Show-averages-in-subtotals-totals-instead-of-sum-for-PBI-pivot/m-p/2344245#M59254</guid>
      <dc:creator>dmitry-wbr</dc:creator>
      <dc:date>2022-02-17T08:36:52Z</dc:date>
    </item>
    <item>
      <title>Re: Show averages in subtotals/totals instead of sum for PBI pivot table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Show-averages-in-subtotals-totals-instead-of-sum-for-PBI-pivot/m-p/2344748#M59274</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="296887" data-lia-user-login="dmitry-wbr" class="lia-mention lia-mention-user"&gt;dmitry-wbr&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;I think you are trying to calculate the average of the sum.&lt;BR /&gt;For each "Department" AVERAGE will calculate the sum of all values of all records of each employee and aggregate the total value for all employees. Then it divides this aggregated value over the total number of records.&amp;nbsp;&lt;BR /&gt;What you actually want is to find the average of the visible values in your matix which is the sum of these values divided by the number of these values.&amp;nbsp;&lt;BR /&gt;This shall not be a problem but the thing that makes it complicated is that you have another filter on the matrix column which is the Year-Month. Therefore more conditions shall apply&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Measure2 =
VAR NumberOfEmployees =
    COUNTROWS ( VALUES ( '12'[Employee_ID] ) )
VAR NumberOfMonths =
    COUNTROWS ( VALUES ( 'Date'[Year-Month] ) )
VAR SumValue =
    SUM ( '12'[FTE] )
VAR Result =
    SWITCH (
        TRUE,
        HASONEVALUE ( '12'[Employee_ID] ) &amp;amp;&amp;amp; HASONEVALUE ( 'Date'[Year-Month] ), SumValue,
        HASONEVALUE ( '12'[Employee_ID] ) &amp;amp;&amp;amp; NOT HASONEVALUE ( 'Date'[Year-Month] ), DIVIDE ( SumValue, NumberOfMonths ),
        DIVIDE ( SumValue, NumberOfEmployees )
    )
RETURN
    Result&lt;/LI-CODE&gt;&lt;P&gt;Please try and let me know&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Feb 2022 12:05:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Show-averages-in-subtotals-totals-instead-of-sum-for-PBI-pivot/m-p/2344748#M59274</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-02-17T12:05:17Z</dc:date>
    </item>
    <item>
      <title>Re: Show averages in subtotals/totals instead of sum for PBI pivot table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Show-averages-in-subtotals-totals-instead-of-sum-for-PBI-pivot/m-p/2344763#M59275</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="296887" data-lia-user-login="dmitry-wbr" class="lia-mention lia-mention-user"&gt;dmitry-wbr&lt;/a&gt;&amp;nbsp;Just need to mention that you need to use the correct table name and column name of&amp;nbsp; "Year-Month"&lt;/P&gt;</description>
      <pubDate>Thu, 17 Feb 2022 12:15:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Show-averages-in-subtotals-totals-instead-of-sum-for-PBI-pivot/m-p/2344763#M59275</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-02-17T12:15:44Z</dc:date>
    </item>
    <item>
      <title>Re: Show averages in subtotals/totals instead of sum for PBI pivot table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Show-averages-in-subtotals-totals-instead-of-sum-for-PBI-pivot/m-p/2345173#M59297</link>
      <description>&lt;P&gt;Wow, that worked perfectly! Thank you a lot!&lt;/P&gt;</description>
      <pubDate>Thu, 17 Feb 2022 14:46:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Show-averages-in-subtotals-totals-instead-of-sum-for-PBI-pivot/m-p/2345173#M59297</guid>
      <dc:creator>dmitry-wbr</dc:creator>
      <dc:date>2022-02-17T14:46:01Z</dc:date>
    </item>
    <item>
      <title>Re: Show averages in subtotals/totals instead of sum for PBI pivot table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Show-averages-in-subtotals-totals-instead-of-sum-for-PBI-pivot/m-p/2345456#M59311</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="296887" data-lia-user-login="dmitry-wbr" class="lia-mention lia-mention-user"&gt;dmitry-wbr&lt;/a&gt;&amp;nbsp;that's great. Please let me know if you need any further help&lt;/P&gt;</description>
      <pubDate>Thu, 17 Feb 2022 16:23:06 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Show-averages-in-subtotals-totals-instead-of-sum-for-PBI-pivot/m-p/2345456#M59311</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-02-17T16:23:06Z</dc:date>
    </item>
  </channel>
</rss>

