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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
npust333
New Member

Aggregate column while keeping the rest of the columns

I have a table like below

Itemdiscount rateprice
Tesla0.2150
Ferrari0.3200
Honda0.4100
Tesla0.2300
Ferrari0.3400

 

As shown above, the "item" column will have duplicate value.

I would like to find a way to aggregate those rows based on the "item" column, and sum all the prices.

However, I want to keep all the other columns still there, which means the "discount rate" value remains the same.

Resulting in the below

Itemdiscount rateprice
Tesla0.2450
Ferrari0.3600
Honda0.4100

 

Is there a way to do that in power query?

Alternatively, I think the discount rate can be summed up as well, but in the end I need to divide it back according to the number of count it was aggregated with. Not sure if that would work

1 ACCEPTED SOLUTION
dufoq3
Super User
Super User

Hi @npust333, you can do simple Group By:

 

dufoq3_0-1714046337620.png

 

If you want to consider also unique discount rate, click to Advanced and add discount rate to groping. (This preserves also discount rate column)

 

dufoq3_1-1714046424332.png

 


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

View solution in original post

3 REPLIES 3
dufoq3
Super User
Super User

Hi @npust333, you can do simple Group By:

 

dufoq3_0-1714046337620.png

 

If you want to consider also unique discount rate, click to Advanced and add discount rate to groping. (This preserves also discount rate column)

 

dufoq3_1-1714046424332.png

 


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

Thank you @Duia 

You're welcome. BTW who is Duia? 😉


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors