I want to add values in a column together that are next to each other in the same column but It is for one invoice number that is in a different column. Any idea what formula I could use in power query?
I want to add values in a column together that are next to each other in the same column but It is for one invoice number that is in a different column. Any idea what formula I could use in power query?
Read the yellow banner at the top of this page. Also, please identify your Excel Version. ie. 2013, 2016, 365 etc.
Alan עַם יִשְׂרָאֵל חַי
Change an Ugly Report with Power Query
Database Normalization
Complete Guide to Power Query
Man's Mind Stretched to New Dimensions Never Returns to Its Original Form
Sorry about that. I went ahead and updated it and I am attaching an example file.
In column A you will see what are supposed to be example Invoice Numbers. There are 1 to 2 lines for each number depending on what items they purchased in column G. You can also see the pricing for each item in column H and the totals for the amounts purchased in columns I.
I need to get the totals for each each invoice, which basically is adding the totals of the items together, and put the grand invoice total in a separate column.
I am trying to do this in power query so when I get a report each month I can just drop it into a folder(like I have been reading online) and have it do this automatically for the thousands of lines I get each month.
Any help would be much appreciated!
I went ahead and added more to my example. I just read I was supposed to have some manually complete calculations.
v A B 1 Column1 Total2 2 769297 78.5 3 772976 74 4 772340 110 5 772970 72.4 6 776212 104 7 775649 114 8 776216 113 9 772983 72.5 10 776214 84 11 772975 102.5 12 776215 77 13 762393 50.3 14 776125 73.6 15 774712 75.5 16 773675 35 17 776210 120 18 775795 28 19 773684 55 20 773546 65 21 776103 72 22 776051 132.5 23 775790 62 24 773530 41 25 776128 89 26 771650 70 27 771470 88 28 771648 94 29 771468 34 30 772974 100 31 776208 184 32 776133 155 33 771466 38.5 34 772978 143.2 35 776129 114
Mcode below:
1. Bring Table into PQPlease Login or Register to view this content.
2. Add Coluumn multiply quantity by price
3. Group on Invoice number and total the new column
Open new file Open Power Query/Get and Transform. Click on New Query.
Open blank query in the editor, launch Advanced Editor and paste in the following code.
Change folder in Red
Please Login or Register to view this content.
Thank you for your reply. I do not think this is what I need. I am currently working with a pq and I am looking for a formula that would take the current information and add the to line totals together for a grand total and put it in a new column next to that data. Also, it has to display the grand total of the invoice on every line that has that invoice number. The invoice numbers are next to each other in column A. If you look at my second example I am adding together the green shaded numbers in column I, which would be the invoice total, then putting the invoice total under the total column but displaying the total on each line of that invoice. Same with the blue shaded numbers. If you look at the red shaded numbers, that invoice has only 1 line item so it would only display the invoice total once since it only has 1 line for that invoice.
I know I am asking for a lot and I appreciate the help. I have never used pq but from what I have read once I change 1 report how I want it I can drop all future reports into that folder and hit refresh and it would run the new report through those changes I made. I can see how it saves the changes in the box on the right side of the screen in excel as I am completing them. If I am mistaken about this tool please let me know.
Thank you!
Ok. A Power Query Update. I created the first table shown above and then created a new merged table joining the two tables (Your Original and my total) on the Invoice number. See the attached file for details and your analysis.
Thread closed pending a new, composite thread.
Ali
Enthusiastic self-taught user of MS Excel who's always learning!
Don't forget to say "thank you" in your thread to anyone who has offered you help.
You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.
Forum Rules (updated August 2023): please read them here.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks