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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
squizzonk
Regular Visitor

DAX Code to sum columns

Very new to DAX, trying to sort out this issue to sum multiple columns and rearrange how it's presented:

 

The table structure that I currently have:

NameProduct AProduct B
Person 112
Person 211

 

Result I'm looking to get:

ProductSum Amount
Product A2
Product B3

 

Would this be achieved by a combination of new measures? Any help super appreciated

 

 

 

1 ACCEPTED SOLUTION
v-sgandrathi
Community Support
Community Support

Hi @squizzonk,

 

I Started by clicking "Enter Data" and created a simple table with columns: Name, Product A, and Product B. After loading the table, navigate to Power Query Editor by selecting "Transform Data" from the Home ribbon. In the editor, select both "Product A" and "Product B" columns while holding Ctrl, then right-click and choose "Unpivot Columns". Rename the resulting "Attribute" column to "Product" and the "Value" column to "Amount". Click "Close & Apply" to return to Power BI. In the report view, insert a Table visual and drag the Product and Amount fields into the visual. Power BI will automatically summarize the Amount by each Product.

 

I have included the PBIX file that I created using the provided sample data. Kindly review it and confirm whether it aligns with your expectations.

Thank you and comtinue using Microsoft Fabric Community Forum.

View solution in original post

5 REPLIES 5
v-sgandrathi
Community Support
Community Support

Hi @squizzonk,

 

I Started by clicking "Enter Data" and created a simple table with columns: Name, Product A, and Product B. After loading the table, navigate to Power Query Editor by selecting "Transform Data" from the Home ribbon. In the editor, select both "Product A" and "Product B" columns while holding Ctrl, then right-click and choose "Unpivot Columns". Rename the resulting "Attribute" column to "Product" and the "Value" column to "Amount". Click "Close & Apply" to return to Power BI. In the report view, insert a Table visual and drag the Product and Amount fields into the visual. Power BI will automatically summarize the Amount by each Product.

 

I have included the PBIX file that I created using the provided sample data. Kindly review it and confirm whether it aligns with your expectations.

Thank you and comtinue using Microsoft Fabric Community Forum.

Thanks much!!

techies
Super User
Super User

Hi @squizzonk you can simply select the Product A and Product B columns in Power Query and use the Unpivot selected columns option

― Power BI | Microsoft Fabric | PL-300 | DP-600 | Blog: medium.com/@cseprs_54978
squizzonk
Regular Visitor

Think the formatting messed up

 

First Table

Name              Product A     Product B

Person1             1                   2

Person2             1                   1

 

 

Result looking for:

Product                 Sum Amount

Product A                      2

Product B                      3

@squizzonk - You need to unpivot this data, here's an article from me on why / how: https://triangle.im/power-bi-mistake-5-why-pivoted-data-leads-to-power-bi-pain/

 

If I answered your question please mark my post as the solution, it helps others with the same challenge find the answer!

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.