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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
lucashmcury
Frequent Visitor

Sum average columns values in Sub Totals on Matrix visual

hi guys,

 

I am using one Matrix visual, as per below image, with column "Category" in Coumns, Values column in Values and Company in rows

lucashmcury_0-1669735225000.png

 

But the Column Sub Total is showing me the average of all columns...and I need the sum

Below is the dax formula I am using to get the average by each column

 

Average of Values average per Company Names =
    AVERAGEX(
    KEEPFILTERS(VALUES('Company'[Names])),
    CALCULATE(AVERAGE('Values'[Values]))
)

 

How can I set the Column Sub Totals to show the sum of all columns averages? 

 

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @lucashmcury 
Please try

Average of Values average per Company Names =
VAR NormalAverage =
    AVERAGEX (
        KEEPFILTERS ( VALUES ( 'Company'[Names] ) ),
        CALCULATE ( AVERAGE ( 'Values'[Values] ) )
    )
VAR SumOfAverage =
    SUMX (
        VALUES ( 'Table'[Category] ),
        CALCULATE (
            AVERAGEX (
                KEEPFILTERS ( VALUES ( 'Company'[Names] ) ),
                CALCULATE ( AVERAGE ( 'Values'[Values] ) )
            )
        )
    )
RETURN
    IF ( ISINSCOPE ( 'Table'[Category] ), NormalAverage, SumOfAverage )

View solution in original post

2 REPLIES 2
tamerj1
Super User
Super User

Hi @lucashmcury 
Please try

Average of Values average per Company Names =
VAR NormalAverage =
    AVERAGEX (
        KEEPFILTERS ( VALUES ( 'Company'[Names] ) ),
        CALCULATE ( AVERAGE ( 'Values'[Values] ) )
    )
VAR SumOfAverage =
    SUMX (
        VALUES ( 'Table'[Category] ),
        CALCULATE (
            AVERAGEX (
                KEEPFILTERS ( VALUES ( 'Company'[Names] ) ),
                CALCULATE ( AVERAGE ( 'Values'[Values] ) )
            )
        )
    )
RETURN
    IF ( ISINSCOPE ( 'Table'[Category] ), NormalAverage, SumOfAverage )

thank you!

 

you are a master!

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.