Power Query - Append Grouped Rows based on specific columns AND row values

lzcrss2

New Member
Joined
Aug 3, 2016
Messages
11
Hi! My data set has 117,000 rows and 14 columns. It is at an item and week level. There is a week column, an item description column, 11 columns of characteristics that describe/classify the item, and finally the value column (cost).

Is it possible, via M code or otherwise, for me to group by certain columns, and only for certain row values, and then append those groupings onto the existing data set?

Here is a fake example data set. In this example, I don't want to append rows for ALL combinations of "Type"+"Size"+"Source", I just want to see all weeks of data for the 2 specific combos at the bottom: Large apple from supermarket and Small orange from farmer's market. This example is just in an Excel spreadsheet where I used SumIfs just to illustrate what I want my query to do.

1613182459954.png
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Filter your data twice for both criteria, then append data again.

You can do this in 1 query, where you refer to an earlier step when needed (m-code knowledge required), or in different queries, referring to another query if you need a UI-based solution.
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,180
Members
452,615
Latest member
bogeys2birdies

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top