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
muggydaniel
New Member

Sum the average of categories

Hi all

 

I need to be able to sum the average of different tasks per state where each individual row represents 1 instance

 

Data: 

State - Animal - Amount Trigger

NSW - Cows - 62 

NSW - Cows - 62

NSW - Chickens - 10 

NSW - Chickens - 10

NSW - Horses - 52 

NSW - Horse - 52

NSW - Horse - 52

 

Where a matrix looks like the below

NSW (total is the sum of the amount triggers = 124 not the average across all individual lines)

- Cow - 62 

- Chicken - 10 

- Horse - 52

 

Help please!

1 ACCEPTED SOLUTION
sevenhills
Super User
Super User

 

Sum - Average of Amount Trigger per Animal = 
 
    If ( HASONEVALUE('Table Category'[Animal]),
        AVERAGE('Table Category'[Amount Trigger]), 
        CALCULATE( SUMX( SUMMARIZE( 'Table Category', 'Table Category'[Animal]), CALCULATE( AVERAGE('Table Category'[Amount Trigger]))))
    )

 

Adjust the format as number if needed.

 

View solution in original post

2 REPLIES 2
muggydaniel
New Member

Thanks heaps it works!

sevenhills
Super User
Super User

 

Sum - Average of Amount Trigger per Animal = 
 
    If ( HASONEVALUE('Table Category'[Animal]),
        AVERAGE('Table Category'[Amount Trigger]), 
        CALCULATE( SUMX( SUMMARIZE( 'Table Category', 'Table Category'[Animal]), CALCULATE( AVERAGE('Table Category'[Amount Trigger]))))
    )

 

Adjust the format as number if needed.

 

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.