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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

How to sum values in a column if they have the same ID in another column

Hi 

I want to add the weight column if they have same PO number.

For Eg.

The same PO have the weight categorized at item level. Below is a sample of data.

I want the total weight for each PO in a separate column So that later I can filter by removing duplicates.(I need the remove duplicates step because there are other columns in the data)

 Initial DataInitial Data

 Required ViewRequired View

2 ACCEPTED SOLUTIONS
drewlewis15
Solution Specialist
Solution Specialist

If you are looking to do this with M via the Query Editor, then you would just use Group By in the Transform tab and group by the PO#, adding one Sum column to get the total sum of weight and one "All Rows" column to bring back in your weight column.

 

 

PO Weight.png

You could then expand your AllRows column to bring back in the columns that you need.

Your final product would look like this:

 

PO Weight Final.png

 

 

 

View solution in original post

You should be able to bring back all other columns when you expand the new AllRows column right after the Group Rows step.

 

This screenshot should help... Just click the double arrows on the AllRows column, and then select all other columns that you want to bring back in.

 

PO.png

View solution in original post

6 REPLIES 6
drewlewis15
Solution Specialist
Solution Specialist

If you are looking to do this with M via the Query Editor, then you would just use Group By in the Transform tab and group by the PO#, adding one Sum column to get the total sum of weight and one "All Rows" column to bring back in your weight column.

 

 

PO Weight.png

You could then expand your AllRows column to bring back in the columns that you need.

Your final product would look like this:

 

PO Weight Final.png

 

 

 

Anonymous
Not applicable

Thanks a lot @drewlewis15

Anonymous
Not applicable

@drewlewis15 When I do this this removes the other columns in data. I have other column in the data as well.

@Anonymous

 

May be you could use a DAX Calculated Column

 

Wt =
CALCULATE ( SUM ( Table1[Weight] ), ALLEXCEPT ( Table1, Table1[PO#] ) )
Anonymous
Not applicable

@Zubair_Muhammad Correct me If I'm worng

We cannot see records if we have a DAX measure in our visual right?

You should be able to bring back all other columns when you expand the new AllRows column right after the Group Rows step.

 

This screenshot should help... Just click the double arrows on the AllRows column, and then select all other columns that you want to bring back in.

 

PO.png

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.