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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

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
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.