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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors