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

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
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.