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
jonnyA
Responsive Resident
Responsive Resident

in a power BI matrix can you sum some totals and average others?

I created a matrix and the Totals in summing all the rows, but I need the highlighted totals to show an average.  Any idea's on how I can make this work?  Example: I want 248 to be 124, which is the average of 127 and 121.

 

jonnyA_0-1599673280441.png

 

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @jonnyA ,

 

A simple example:

Measure =
IF (
    NOT ( HASONEVALUE ( 'Table'[YearMonth] ) )
        && SELECTEDVALUE ( 'Table'[Product] ) IN { "B", "C" },
    AVERAGE ( 'Table'[Value] ),
    SUM ( 'Table'[Value] )
)

YM.PNG

 

 

Best Regards,

Icey

 

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

View solution in original post

8 REPLIES 8
Icey
Community Support
Community Support

Hi @jonnyA ,

 

A simple example:

Measure =
IF (
    NOT ( HASONEVALUE ( 'Table'[YearMonth] ) )
        && SELECTEDVALUE ( 'Table'[Product] ) IN { "B", "C" },
    AVERAGE ( 'Table'[Value] ),
    SUM ( 'Table'[Value] )
)

YM.PNG

 

 

Best Regards,

Icey

 

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

jonnyA
Responsive Resident
Responsive Resident

Hey @Icey Icey, Thanks for your answer!!!

But I need help plugging in the formula you provided, i'm a beginner level Power BI analyst.

You provider this formula ...

Measure =
IF (
    NOT ( HASONEVALUE ( 'Table'[YearMonth] ) )
        && SELECTEDVALUE ( 'Table'[Product] ) IN { "B", "C" },
    AVERAGE ( 'Table'[Value] ),
    SUM ( 'Table'[Value] )
)
 

10.5 Power BI AvgDailyCharge.PNG

Here are the Fields I have for the dataset mentioned ...See pic for the "Fields" I have to work with.

 
 
 
 

 

 

 

 

 

jonnyA
Responsive Resident
Responsive Resident

@Icey Did you see my response?  I am stuck with trying to get this to work.

 

Thank you in advance!

Icey
Community Support
Community Support

Hi @jonnyA ,

 

Sorry to reply late. Please try this:

Measure =
IF (
     (
        NOT ( HASONEVALUE ( 'Table'[YearMonth] ) )
            && SELECTEDVALUE ( 'Table'[Product] ) IN { "B", "C" }
    )
        || (
            NOT ( HASONEVALUE ( 'Table'[YearMonth] ) )
                && NOT ( HASONEVALUE ( 'Table'[Product] ) )
        ),
    AVERAGE ( 'Table'[Value] ),
    SUM ( 'Table'[Value] )
)

 

 

Best Regards,

Icey

 

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

jonnyA
Responsive Resident
Responsive Resident

@Icey @Greg_Deckler 

 

I think I am close to getting this formula to work.

Here is the formula that Icey gave me, but I did tweak it some (Probaly easier to read in the screenshot I provided)...

Power BI Comm 2 =
IF (
(
NOT ( HASONEVALUE ( 'DateOfServiceAnalysis'[MTHYear_Sort] ) )
&& SELECTEDVALUE ( 'DateOfServiceAnalysis'[MTHYear_Sort] ) IN { "AvgDailyChg" }
)
|| (
NOT ( HASONEVALUE ( 'DateOfServiceAnalysis'[MTHYear_Sort] ) )
&& NOT ( HASONEVALUE ( 'DateOfServiceAnalysis'[AvgDailyChg] ) )
),
AVERAGE ( 'DateOfServiceAnalysis'[AvgDailyChg] ),
SUM ( 'DateOfServiceAnalysis'[AvgDailyChg] )
)
Do you two have any advice on how I can make this work for the total to Average?
 
Thanks so much in advance!
PBI 10.14.PNG
 
Icey
Community Support
Community Support

Hi @jonnyA ,

 

Are these the names of multiple measures? The value field is not just one measure?

10.5 Power BI AvgDailyCharge.PNG

 

 

Best Regards,

Icey

jonnyA
Responsive Resident
Responsive Resident

@Icey It is just one measure.

Greg_Deckler
Community Champion
Community Champion

@jonnyA - If you can identify those rows somehow like HASONEVALUE or ISINSCOPE, probably, see MM3TR&R - https://community.powerbi.com/t5/Quick-Measures-Gallery/Matrix-Measure-Total-Triple-Threat-Rock-amp-...

 

Would need sample data to be more specific. Or a more encompassing screen shot.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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.