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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! 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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.