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

View all the Fabric Data Days sessions on demand. View schedule

Reply
4778
New Member

Average top level of matrix, sum for lower levels

Hi, 

I need to show an average at the top level of a matrix and a sum for the lower 2 levels. 

 

The values is a measure and is:

Planned Loading % =
IF(
    HASONEVALUE(Sheet1[PROJECT_ID]),
    SUMX('Sheet1',(Sheet1[PLANNED_HOURS])/(Sheet1[Working Hours Per Week Per Employee])),  -- Actual values for lowest level
    IF(
        HASONEVALUE(Sheet1[RESOURCE_ID]),
        SUMX(Sheet1,(Sheet1[PLANNED_HOURS])/(Sheet1[Working Hours Per Week Per Employee])),  -- Summed values for middle level
        AVERAGEX(Sheet1,(Sheet1[PLANNED_HOURS])/(Sheet1[Working Hours Per Week Per Employee]))  -- Average for top level, Average should be each person's % divided by count of persons not average of each row
    )
)

 

The 1st and 2nd part works, it shows sums.

The 3rd part does not, 

 

Expected state is:

4778_1-1700830616472.png


but I get:

4778_2-1700830624497.png

 

https://drive.google.com/file/d/1msrpR6l5mK8zXqU-F_JyM5dHQ4JsK0Rp/view?usp=drive_link

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@4778 


Use the following modified mesaure: 

Planned Loading % = 

SWITCH(
    TRUE(),
    HASONEVALUE(Sheet1[PROJECT_ID]), SUMX('Sheet1',(Sheet1[PLANNED_HOURS])/(Sheet1[Working Hours Per Week Per Employee])),  
    HASONEVALUE(Sheet1[RESOURCE_ID]), SUMX(Sheet1,(Sheet1[PLANNED_HOURS])/(Sheet1[Working Hours Per Week Per Employee])),  
        AVERAGEX(
            VALUES( Sheet1[RESOURCE_ID] ),
            CALCULATE(SUMX(Sheet1,(Sheet1[PLANNED_HOURS])/(Sheet1[Working Hours Per Week Per Employee]))))
    )

 

Fowmy_0-1700893315489.png



 



Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

5 REPLIES 5
Fowmy
Super User
Super User

@4778 


Use the following modified mesaure: 

Planned Loading % = 

SWITCH(
    TRUE(),
    HASONEVALUE(Sheet1[PROJECT_ID]), SUMX('Sheet1',(Sheet1[PLANNED_HOURS])/(Sheet1[Working Hours Per Week Per Employee])),  
    HASONEVALUE(Sheet1[RESOURCE_ID]), SUMX(Sheet1,(Sheet1[PLANNED_HOURS])/(Sheet1[Working Hours Per Week Per Employee])),  
        AVERAGEX(
            VALUES( Sheet1[RESOURCE_ID] ),
            CALCULATE(SUMX(Sheet1,(Sheet1[PLANNED_HOURS])/(Sheet1[Working Hours Per Week Per Employee]))))
    )

 

Fowmy_0-1700893315489.png



 



Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Awsome, this seems to  be working as required - thanks! 

Fowmy
Super User
Super User

@4778 

You can save your Power BI file in OneDrive, Google Drive or any other cloud storage and share the link here.

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Please grant access

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors