Power Query - Consolidate Multiple files and Transpose data

Rajeevaon

New Member
Joined
Dec 5, 2017
Messages
6
Hi experts, I am relatively new to power query and I have a very complicated scenario (at least I believe so).

With my limited knowledge on power query I couldn't achieve my desired output.

I humbly request you to provide me solution or a workaround to achieve my expected results.

I have multiple files as below,

Sales-Jan.xlsx
Sales-Jan-A.xlsx
Sales-Feb.xlsx
Sales-Mar.xlsx
Sales-Mar-A.xlsx
Sales-Mar-B.xlsx
Sales-Apr.xlsx
Sales-May.xlsx
Sales-May-A.xlsx
Sales-Jun.xlsx

etc tec, and goin for every month.
Each file contains more than 100 rows,
All the files has identical column names and, no of columns and same column order

Every file contains similar data as below (for eg: Assume Sales-Jan.xlsx file);

Item GroupItem CodeItem NameUOMSalesSales ReturnNet SalesClosing Stock
BRANCH-A-XXXXXXX
AABC1NAME1NOS10.002.008.001.00
AABC2NAME2NOS15.003.5011.5010.00
AABC3NAME3KG200.0044.50155.50350.00
AABC4NAME4PKT100.00105.00(5.00)25.00
BBA1NAME8L150.0045.50104.50100.00
BB2ANAME8L28.002.5025.505.00
BRANCH-B-XXXXX
AABC2NAME2NOS300.0015.80284.205.00
AABC3NAME3KG25.004.0021.002.00
CCB1NAME9NOS255.503.00252.50400.00
CCB2NAME10NOS38.5045.00(6.50)25.00
BRANCH-C-XXXXX
BBA1NAME8L45.5050.00(4.50)35.00
BB2ANAME8L48.2530.0018.2585.00
AABC4NAME4PKT30.0025.005.00240.00
CCB2NAME10NOS25.004.0021.0045.00

I would wanted all of those files combined and transformed and transposed as below

Item CodeBranchJanFebMarAprMayJunCount of Non Blank Cells
ABC1BRANCH-A8.0085.0035.0032.0050.00
5​
ABC2BRANCH-A11.5025.0080.00100.0052.001.00
6​
ABC3BRANCH-A155.5045.0035.0010.00
4​
ABC4BRANCH-A15.0010.00
2​
B2ABRANCH-A25.5045.0084.0098.0032.004.00
6​
BA1BRANCH-A104.5039.00820.0045.0087.008.00
6​
ABC2BRANCH-B284.20897.00486.0058.00
4​
ABC3BRANCH-B21.0048.0054.0064.009.004.00
6​
CB1BRANCH-B252.508.0046.0048.0096.00
5​
CB2BRANCH-B468.006.00864.0064.00
4​
ABC4BRANCH-C5.00100.0057.0097.0013.0022.00
6​
B2ABRANCH-C18.2595.0058.0099.00100.00
5​
BA1BRANCH-C65.0054.009.00856.005.00
5​
CB2BRANCH-C21.0071.00525.0075.005.00
5​

in the output table must have below points,

branch names contains unwanted text (see bold text and its not unique, I hope can do with split text with delimiter)
column names must be taken from the file name, eg : Jan, Feb, Mar etc
each and every file's net sales value plotted into its relevant column, eg: Jan net sales into Jan Column , Feb Net sales into Feb Column
negative figures must be converted to null (See bold cell values in the raw data table)
a custom column must be added to count non blank cells for each row (In the last)

this final table used as a raw data for further calculation by merging to existing queries.

thanks in advance for your time and support.

Also posted here https://www.myonlinetraininghub.com...consolidate-multiple-files-and-transpose-data
 
Last edited by a moderator:

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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