Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Averages in subtotals/totals instead of sum

Hi Experts

 

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:

BlueWhite111_0-1669929101554.png

 


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:

BlueWhite111_1-1669929101560.png

 

I have tried DAX formulas with AVERAGEX, but it allows for average aggregation only across single dimension.

1 ACCEPTED SOLUTION
jgeddes
Super User
Super User

I created a dataset

jgeddes_0-1669931731019.png

Wrote the following measure...

Measure = 
var _vTable =
SUMMARIZE(
    emptable,
    emptable[Employee],
    emptable[Date].[Year],
    emptable[Date].[Month],
    "_val", SUM(emptable[Value])
)
var _result =
AVERAGEX(_vTable, [_val])
Return
_result

Where you create a summary table by employee and date and then take the averages of that table.

(It will depend on how your dates are set up. If you had a combined Year/Month column you should only have to add that column to summarize by.)

The result...

jgeddes_1-1669931795284.png

 

Hope this gets you pointed in the right direction.




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

1 REPLY 1
jgeddes
Super User
Super User

I created a dataset

jgeddes_0-1669931731019.png

Wrote the following measure...

Measure = 
var _vTable =
SUMMARIZE(
    emptable,
    emptable[Employee],
    emptable[Date].[Year],
    emptable[Date].[Month],
    "_val", SUM(emptable[Value])
)
var _result =
AVERAGEX(_vTable, [_val])
Return
_result

Where you create a summary table by employee and date and then take the averages of that table.

(It will depend on how your dates are set up. If you had a combined Year/Month column you should only have to add that column to summarize by.)

The result...

jgeddes_1-1669931795284.png

 

Hope this gets you pointed in the right direction.




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.