Mar 23 2022 11:07 PM
So some orders will have multiple line items and that creates a duplicate of the sales order number, all i need is a total cost of goods sold for the whole order. So in the first highlighted example you can see they purchased 2 ea of 2 different items the cost of one being 0.03 and the second 0.10 so the total cost is 0.26 for the order in total. I need a field with an updated cost and to delete the extra rows. Please bear in mind I am working with large sets of data and need this to be a function or something that works more or less automatically without me having to try and find all orders with multiple lines.
Mar 23 2022 11:58 PM
@Modnar1 Perhaps Power Query can help. The attached file contains a query that calculates total CoGS by order number. If that's not what you had in mind, please clarify how the end result should look like.
Mar 25 2022 04:01 AM
Mar 25 2022 04:19 AM
@Modnar1 That's exactly where Power Query comes is. You connect to a data source and perform all sorts of transformations. Each of these these are "recorded" in their own step and will be executed every time you press Refresh. In the example I uploaded earlier, I connected to the data that I named "myData". That's what you can see in the very first applied step.
Source = Excel.CurrentWorkbook(){[Name="myData"]}[Content],
But you can connect to a table, a CSV file, a web-page and many more sources.
You may remove everything in A1:I17 in Sheet1 and paste new data somewhere else. But the structure must be the same as the original (i.e. the column names must be the same), but you can paste thousands of rows. As long as you name the entire data set "myData", you can Refresh the query I created. Lear more about PQ in the link below.