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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
cgallegos
Regular Visitor

Sum of a Calculated Average Column

Hello,

I am trying to get the subtotal in the December Average Column below to display the total sum of those averages. Instead it is giving me the average. Would someone be able to help me find a solution to get the Sum?

 

cgallegos_0-1643643961335.png

Here is the Average DAX I used. 

cgallegos_1-1643644010125.png

 

Let me know if there is anything else I can provide that would be helpful. Thank you!

 

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @cgallegos 

 

If you are trying to control the output of total, you can use IF(HASONEVALUE(),average output, total output).

 

For example, the first output in the IF function is the average of the columns in the Matrix view, and the second output is Total, which outputs the sum of the averages.

Measure = 
IF (
    HASONEVALUE ( 'Table'[date] ),
    CALCULATE (
        AVERAGE ( 'Table'[Sales] ),
        FILTER ( ALL ( 'Table' ), [date] = MAX ( 'Table'[date] ) )
    ),
    SUMX (
        SUMMARIZE (
            'Table',
            'Table'[date],
            "average",
                CALCULATE (
                    AVERAGE ( 'Table'[sales] ),
                    FILTER ( ALL ( 'Table' ), [date] = MAX ( 'Table'[date] ) )
                )
        ), [average] ) )

vzhangti_1-1644225490396.png

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more.

View solution in original post

4 REPLIES 4
v-zhangti
Community Support
Community Support

Hi, @cgallegos 

 

If you are trying to control the output of total, you can use IF(HASONEVALUE(),average output, total output).

 

For example, the first output in the IF function is the average of the columns in the Matrix view, and the second output is Total, which outputs the sum of the averages.

Measure = 
IF (
    HASONEVALUE ( 'Table'[date] ),
    CALCULATE (
        AVERAGE ( 'Table'[Sales] ),
        FILTER ( ALL ( 'Table' ), [date] = MAX ( 'Table'[date] ) )
    ),
    SUMX (
        SUMMARIZE (
            'Table',
            'Table'[date],
            "average",
                CALCULATE (
                    AVERAGE ( 'Table'[sales] ),
                    FILTER ( ALL ( 'Table' ), [date] = MAX ( 'Table'[date] ) )
                )
        ), [average] ) )

vzhangti_1-1644225490396.png

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more.

ValtteriN
Super User
Super User

Hi,

You can change the calculation logic in total row using this pattern: IF(ISBLANK(SELECTEDVALUE(Table[Region/Group])),[SUM logic],[Averagex logic])

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi,

Can you provide a little more guideance? I'm not understanding what to use for the sum logic.

@cgallegos , Other than the last solution provided

 

You can also try Sumx(Values(Table[Region/Group]), [Average Measure])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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