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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
shuberml
Frequent Visitor

Sum By Row

Hello! 

 

Need help with the correct approach to do the following. I have a table that looks like: 

StoreStateProductSales
ACAApple5
ACAPear1
ACAOrange1
ACACelery5
BCAApple5
BCAPear5
BCAOrange5
BCACelery1
CTXApple5
CTXPear5
CTXOrange4
CTXCelery1

 

I'd like to add rows with the sum of the fruits:

 

ACAFruit7
BCAFruit15
CTXFruit14

 

1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @shuberml 

Create a table with category and product as below, then relate two tables with "product" column,

Capture1.JPG

Add columns into matrix and select "sum" aggregation, set filters as below:

Capture2.JPGCapture3.JPG

Best Regards
Maggie
Community Support Team _ Maggie Li
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
shuberml
Frequent Visitor

Thank you both! Used the second solution, but both were effective!

v-juanli-msft
Community Support
Community Support

Hi @shuberml 

Create a table with category and product as below, then relate two tables with "product" column,

Capture1.JPG

Add columns into matrix and select "sum" aggregation, set filters as below:

Capture2.JPGCapture3.JPG

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@shuberml , You need to define a category fruit / not fruit, and then it a simple sum.

This can be calculated column

Type = if([Product]<>"Celery","Fruit","Not Fruit")

Then you can filter on Fruit.

 

Or you can try SEGMENTATION

https://www.daxpatterns.com/dynamic-segmentation/
https://www.daxpatterns.com/static-segmentation/
https://www.poweredsolutions.co/2020/01/11/dax-vs-power-query-static-segmentation-in-power-bi-dax-po...
https://radacad.com/grouping-and-binning-step-towards-better-data-visualization

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.