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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

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!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

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