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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
ipeto
New Member

Aggregation of unique subcategories by category

Hi there,

 

I'm a total newbie in DAX and struggling with this dataset:

CategoriesSubcategoriesValueTotal category value [desired]
Cat ASubcat 11050
Cat ASubcat 11050
Cat ASubcat 24050
Cat BSubcat 32070
Cat BSubcat 32070
Cat ASubcat 24050
Cat BSubcat 45070

 

I have to create Total category value as a calculated column which contains the aggregated value of unique subcategories by category. For example 'Cat A' has two subcategories (Subcat 1 and 2) with multiple rows. 'Total category value' should be 10+40=50.

 

Thank you for your help!

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @ipeto

1.png2.png 

Total Category Value = 
CALCULATE (
    SUMX ( 
        SUMMARIZE ( 
            'Table',
            'Table'[Categories], 
            'Table'[Subcategories] 
        ),
        CALCULATE ( MAX ( 'Table'[Value] ) )
    ),
    ALLEXCEPT ( 'Table', 'Table'[Categories] ) 
)

View solution in original post

2 REPLIES 2
tamerj1
Super User
Super User

Hi @ipeto

1.png2.png 

Total Category Value = 
CALCULATE (
    SUMX ( 
        SUMMARIZE ( 
            'Table',
            'Table'[Categories], 
            'Table'[Subcategories] 
        ),
        CALCULATE ( MAX ( 'Table'[Value] ) )
    ),
    ALLEXCEPT ( 'Table', 'Table'[Categories] ) 
)

Thank you for the superfast answer!

I have found parts of the solution, but I was unable to put them together.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.