Active Member
August 31, 2020
Hello! I am very much in need assistance with the final few steps needed for my query.
Part 1: In my sample data, there are monthly amounts currently listed on 3 columns that are 4 months deep. The formatting is JAN/APR/JUL/OCT, FEB/MAY/AUG/NOV, and MAR/JUN/SEP/DEC, so the data should be read as: Jan, Feb, Mar, <next line> Apr, May, June <next line> July, August, Sept <next line> Oct, Nov, Dec. What I would like to do is to create 3 new columns beside each of the monthly columns that says what month each row of data is.
Part 2: I would like to consolidate all the months on one row, and all of the corresponding amounts on one row as well, instead of 6 columns total.
I've attached screenshots and a sample workbook for your review. Thank you VERY MUCH in advance. I very much appreciate it!
October 5, 2010
Hi Florence,
Welcome to the forum. Your attachments did not attach, did you click on the 'Start Upload' button?
Please see here for (video) instructions on attaching files
https://www.myonlinetraininghu.....this-first
It sounds like your data isn't in the correct tabular format needed to work properly with Power Query. You should have a column called month and the months listed in that, not a column for every month.
If you can please reattach your files I'll take a look.
Regards
Phil
October 5, 2010
Hi Florence,
That data dump is in a really bad format for working with! I'm sure it's not you fault but it would make lives so much easier if data exports were laid out in a helpful way. Then again,I guess that's why we need Power Query.
Please have a look at the attached file.
I've added some extra queries to the query you created and have then appended them together to make a final query giving the amounts by month for each Acct Number/Title. The resulting table is on the sheet 'Appended Queries'.
I haven't done anything with the values for QTD and YTD but assume they can be treated in the same way as the monthly values.
To get this final table I've taken the output from your '948' query and then using the Index column used Number.Mod to add a new column with the month names where they should be. Repeat this for the other 2 month columns and then by appending the whole lot back together you should get what you are after?
I also started from scratch with my own query which you'll see in the MOTH Query Group in the PQ Editor. Because there are no delimiting characters in the source files, I've had to import using fixed width which will break if the width of the columns in the source files is changed.
It's the same idea though. Create an Index column then use that to create columns for the months,and QTD and YTD, then append the queries to get your final table which is on the sheet 'MOTH'.
Hopefully this is what you are after.
For these queries to work you'll need to change the path to the source files in the relevant queries.
Regards
Phil
Answers Post
1 Guest(s)