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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

Calculate average in a matrix table

Hi all,

 

I am calculate a average value in a matrix table. Every worker has record, 1 or 0(Column 0 or 1). If there is any record not 0, it count 1(Column Max of 0 or 1). What I want is average as showing in the picture. I spent a lot of time to write a measure, but it is always wrong. Really need help!!

Thank you in advance!

Bran

 

Average =
VAR _count =
    ISINSCOPE ( 'Test'[Name] )
VAR _MAX = if(max('Test'[0 or 1])=1,1,0)
RETURN
    IF (
        _count,
        MAX ( 'Test'[0 or 1]),
           
            DIVIDE(calculate(COUNT('Test'[Name]),_MAX=1),distinctcount('Test'[Name]))
       )

 

 

Screenshot 2022-07-28 111222.png

Job DescName 0 or 1
ForemanAllan Doole0
ForemanAllan Doole0
ForemanAllan Doole0
ForemanAllan Doole0
ForemanAllan Doole0
ForemanBen Ju1
ForemanBen Ju0
ForemanBen Ju1
ForemanBen Ju1
Project ManagerAndy Young1
Project ManagerAndy Young0
Project ManagerAndy Young0
Project ManagerAndy Young0
Project ManagerCraig Thorsen0
Project ManagerCraig Thorsen0
Project ManagerCraig Thorsen0
Project ManagerCraig Thorsen0
Project ManagerCraig Thorsen0
Safety CoordinatorAbednego Shu1
Safety CoordinatorAbednego Shu0
Safety CoordinatorAbednego Shu0
Safety CoordinatorAbednego Shu0
Safety CoordinatorAbednego Shu0
Safety CoordinatorAbednego Shu0
Safety CoordinatorAndrew Hadley0
Safety CoordinatorAndrew Hadley1
Safety CoordinatorAndrew Hadley1
Safety CoordinatorAndrew Hadley0
Safety CoordinatorAndrew Hadley0

 

 

 

 

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @Anonymous 
Please try

 

Average =
AVERAGEX (
    VALUES ( 'Test'[Name] ),
    CALCULATE ( MAX ( 'Test'[0 or 1] ) )
)

 

View solution in original post

1 REPLY 1
tamerj1
Super User
Super User

Hi @Anonymous 
Please try

 

Average =
AVERAGEX (
    VALUES ( 'Test'[Name] ),
    CALCULATE ( MAX ( 'Test'[0 or 1] ) )
)

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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