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 September 15. Request your voucher.

Reply
Anonymous
Not applicable

Sum specific columns based on column names

Hi there,

 

I have a data table with this layout and I want to have a formula in column Total Value (highlighted) that automatically sum by rows only the columns that contain "Sales value", in this case: Product 1 - Sales value, Product 2 - Sales value, Product 3 - Sales value.

Capture.JPG

The idea is that if I have more products and columns, I don't have to manually add each column to the Sum formula.

 

Any suggestion on how I go about doing that?

 

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

Hi,

 

According to your description, i create a table to test:

201.PNG

Then, unpivot it in Query Editor, after Apply&Close, it shows:

202.PNG

Then, choose a matrix visual and apply a visual filter to filter other columns which do not contain 'Sales value', and it shows:

203.PNG

 

Here is my test pbix.

pbix 

Hope this helps.

 

Best Regards,

Giotto Zhi

View solution in original post

5 REPLIES 5
v-gizhi-msft
Community Support
Community Support

Hi,

 

According to your description, i create a table to test:

201.PNG

Then, unpivot it in Query Editor, after Apply&Close, it shows:

202.PNG

Then, choose a matrix visual and apply a visual filter to filter other columns which do not contain 'Sales value', and it shows:

203.PNG

 

Here is my test pbix.

pbix 

Hope this helps.

 

Best Regards,

Giotto Zhi

Ashish_Mathur
Super User
Super User

Hi,

The layout of your Table is not good.  In the Query Editor, right click on the first column's heading and select "Unpivot other columns".  Right click on the Attribute columns and split the column by -.  Click on any cell in the third column and go to Transformations > Pivot column.  Select Value and "Dont Aggregate".  Now drag the first column to the visual and write this measure

Revenue = SUM(Data[Sales value])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Thanks.. what if it's a calculated table and it's not possible to unpivot?

Hi,

I will not be able to help with this.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
amitchandak
Super User
Super User

If you create a matrix(with product on columns ) with row total. and then filter product then it should work in the same manner?

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

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.