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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
gaLaii
Regular Visitor

Sum of Average of each subcategory in Visual Table

Hi

 

I have a table with  categories and subcategories. i want to display i power BI visual table the average of the subcategories but display the sum of the average subcategories  per category. here is the sample result and sample table source below. 

 

Sample Table 

DateCategorySub-CategoryScore
10-JanCategory 1Sub-Category 11
10-JanCategory 1Sub-Category 25
10-JanCategory 1Sub-Category 35
10-JanCategory 1Sub-Category 45
10-JanCategory 1Sub-Category 54
10-JanCategory 1Sub-Category 65
10-JanCategory 2Sub-Category 15
10-JanCategory 2Sub-Category 22
10-JanCategory 2Sub-Category 31
10-JanCategory 2Sub-Category 42
10-JanCategory 3Sub-Category 15
10-JanCategory 3Sub-Category 21
10-JanCategory 4Sub-Category 14
10-JanCategory 4Sub-Category 22
10-JanCategory 4Sub-Category 34
10-JanCategory 4Sub-Category 45
10-JanCategory 4Sub-Category 52
11-JanCategory 1Sub-Category 15
11-JanCategory 1Sub-Category 24
11-JanCategory 1Sub-Category 33
11-JanCategory 1Sub-Category 45
11-JanCategory 1Sub-Category 54
11-JanCategory 1Sub-Category 62
11-JanCategory 2Sub-Category 14
11-JanCategory 2Sub-Category 21
11-JanCategory 2Sub-Category 32
11-JanCategory 2Sub-Category 43
11-JanCategory 3Sub-Category 15
11-JanCategory 3Sub-Category 25
11-JanCategory 4Sub-Category 11
11-JanCategory 4Sub-Category 25
11-JanCategory 4Sub-Category 34
11-JanCategory 4Sub-Category 44
11-JanCategory 4Sub-Category 55

 

Desired Result in power bi

gaLaii_0-1674838107836.png

 

 

 

 

 

 

 

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @gaLaii ,

 

With amitchandak's measure, you will get correct result in subtotal, however incorrect in Total.

RicoZhou_0-1675071892367.png

You can try my code to create a measure.

Sum of Avg =
VAR _SUMMARIZE =
    SUMMARIZE (
        'Table',
        'Table'[Category],
        'Table'[Sub-Category],
        "Avg", AVERAGE ( 'Table'[Score] )
    )
RETURN
    SUMX ( _SUMMARIZE, [Avg] )

Result is as below.

RicoZhou_1-1675071934267.png

 

Best Regards,
Rico Zhou

 

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

3 REPLIES 3
Anonymous
Not applicable

Hi @gaLaii ,

 

With amitchandak's measure, you will get correct result in subtotal, however incorrect in Total.

RicoZhou_0-1675071892367.png

You can try my code to create a measure.

Sum of Avg =
VAR _SUMMARIZE =
    SUMMARIZE (
        'Table',
        'Table'[Category],
        'Table'[Sub-Category],
        "Avg", AVERAGE ( 'Table'[Score] )
    )
RETURN
    SUMX ( _SUMMARIZE, [Avg] )

Result is as below.

RicoZhou_1-1675071934267.png

 

Best Regards,
Rico Zhou

 

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

Thank you so much.. Appreciate it!!!

amitchandak
Super User
Super User

@gaLaii , Try a measure like

Sumx(Values(Table[Sub Category]), calculate(Average(Table[Score]) ) )

 

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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.