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
PowerBi888
Helper I
Helper I

Sum of Average data that Group by 2 Columns

Hi,

            I would like to group data from 2 Colum from TableSale and average Target Sale Value, then sum in total value :

Branch ,      Product  , ColumnC , Target Sale Value

Branch1   ,  Product1 ,  Day1       , 10

Branch1   ,  Product1 ,  Day2       , 10

Branch1   ,  Product2 ,  Day1       , 5

Branch1   ,  Product2 ,  Day2       , 5

Branch1   , Product3 ,   Day1       ,  3

Branch1   , Product3 ,   Day1       ,  3

               I would like to show Matrix result like this :

====================================

Branch ,      Product , Average Target Sale Value

Branch1   ,  Product1 , 10

Branch1   ,  Product2 ,   5

Branch1   ,  Product3 ,   3

Total                   =     ,  18

              now I use this measure -->

AverageValueX = SUMX( TableSale ,CALCULATE(AVERAGEX(TableSale,Target Sale Value),ALLEXCEPT( TableSale ,Branch ,      Product)))
   but Data it's not average

 

1 ACCEPTED SOLUTION
VahidDM
Super User
Super User

Hi @PowerBi888 

 

Try this measure:

Avr. =
VAR _A =
    AVERAGE ( 'Table'[Target Sale Value] )
RETURN
    IF (
        HASONEVALUE ( 'Table'[Product] ),
        _A,
        SUMX (
            SUMMARIZE (
                'Table',
                'Table'[Branch ],
                'Table'[Product],
                "AV", AVERAGE ( 'Table'[Target Sale Value] )
            ),
            [AV]
        )
    )

 

 output:

VahidDM_0-1642144142719.png

 

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

View solution in original post

4 REPLIES 4
VahidDM
Super User
Super User

Hi @PowerBi888 

 

Try this measure:

Avr. =
VAR _A =
    AVERAGE ( 'Table'[Target Sale Value] )
RETURN
    IF (
        HASONEVALUE ( 'Table'[Product] ),
        _A,
        SUMX (
            SUMMARIZE (
                'Table',
                'Table'[Branch ],
                'Table'[Product],
                "AV", AVERAGE ( 'Table'[Target Sale Value] )
            ),
            [AV]
        )
    )

 

 output:

VahidDM_0-1642144142719.png

 

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

Thank you VahidDM , this solution I solved it. 

jaideepnema
Solution Sage
Solution Sage

Hi @PowerBi888 ,
Create a measure like this

Average = SUMX(VALUES('Table'[Product]),calculate(AVERAGE('Table'[Target Sales Value]),ALLEXCEPT('Table','Table'[Product])))
 
Check the attached file for your reference.
 

Please accept this as a solution if your question has been answered !!

Appreciate a Kudos 😀

 

Connect with me on LinkedIn: https://www.linkedin.com/in/jaideepnema/

 

Hi , Average value show correct , but my issued it's grand total in Matrix show not correct. It's not sum vlaue

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.

Top Solution Authors