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! Learn more

Reply
Anonymous
Not applicable

SUM column based on distinct ID

Hi all!

 

I cant seem to figure out the following (which looks very straightforward)

I have a dataset which shows how much meter a category has in a store. 

The data set has rows for each article within a category, but the 'Length of Category' column is based on the total of that category.

 

For example, in store 1, the Bread Category has 2,0 meter of space.

 

Store IDCategoryArticleLength of Category (in meters)
1BreadWhite2,0
1BreadBrown2,0
1DrinksWater4,0
1DrinksSoda4,0

 

For the example above, if I sum how much total meters store 1 has, it will add up to 12,0 (2+2+4+4), but I need it to be 6 (2+4). As I dont want the categories to double.

 

What is the correct way of doing this through dax? I cant seem to google it or figure it out and I feel like it's quite easy.

Help is much appreciated!

1 ACCEPTED SOLUTION
ERD
Community Champion
Community Champion

Hi @Anonymous ,

You can try this measure:

meters per store = 
VAR t = SUMMARIZE ( 'Table', 'Table'[Store ID], 'Table'[Category], 'Table'[Length of Category (in meters)] )
RETURN
    SUMX ( t, [Length of Category (in meters)] )

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

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

View solution in original post

2 REPLIES 2
ERD
Community Champion
Community Champion

Hi @Anonymous ,

You can try this measure:

meters per store = 
VAR t = SUMMARIZE ( 'Table', 'Table'[Store ID], 'Table'[Category], 'Table'[Length of Category (in meters)] )
RETURN
    SUMX ( t, [Length of Category (in meters)] )

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

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

Anonymous
Not applicable

Worked like a charm! 

Thanks for the time and help! 🙂

Helpful resources

Announcements
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!

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.