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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
AiolosZhao
Memorable Member
Memorable Member

In Power Query Editor, how to add columns which need sum and group by?

Hi all,

 

I'm new to Power BI, so I really hope that you can tell me the solution step by step.

 

I have data like below :

KeyTypeAmount1Amount2
1A6010
1B3020
2A4020
2B7050
3A10090

 

Acutally I have a lot of "amount", "amount1,2,3,4,...", and in this example, I want to add 2 columns in Power Query Editor, like below:

KeyTypeAmount1Amount2New Amount1New Amount2
1A60109030
1B30209030
2A402011070
2B705011070
3A1009010090

 

Logic is, sum(amount1) group by key and type

 

I'm not familiar with the M Query, so I don't know how to add these 2 columns, please help!

 

Thanks in advanced.

 

Aiolos Zhao





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




1 ACCEPTED SOLUTION
5 REPLIES 5
Anonymous
Not applicable

Hi 

 

You can use group by function to group with KEY and TYPE

 

image.png

 

 

image.png

Hi @Anonymous ,

 

thanks for reply, but after I use the group by, I won't have amount1 and amount2.

what I want is keep all column in table2 and add 2 columns.

 

Thanks.

Aiolos 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

thanks, that's what I want.

 

but unforunately, my data is too large, and when I use that method, it takes too long to apply the data.

 

do you have any other idea to solve that?

 

Thanks.

Aiolos





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




AiolosZhao
Memorable Member
Memorable Member

Anyone can help to solve this question?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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