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
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
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.