Advertisement
DVL00

PQ Error

Mar 2nd, 2023
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. let
  2. //Change next line to reflect actual data source
  3.  
  4. Source = Production,
  5. /*If data not sorted as per your example add a sorting step here*/
  6. //Add Index for subsequent sorting
  7. #"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index", 0, 1, Int64.Type),
  8. //group by StoreNumber, StoreName and DepartmentName
  9. //then add aggregation with a shifted EndingInventoryAmount column
  10. //which would be the Beg_Inv for that row
  11. #"Grouped Rows" = Table.Group(#"Added Index", {"StoreNumber", "StoreName", "DepartmentName"}, { {"Starting", (t)=>Table.FromColumns( Table.ToColumns(t) & {{null} & List.RemoveLastN(t[EndingInventoryAmount],1)}, type table [StoreNumber=nullable number, StoreName=nullable text, DepartmentName=nullable text, WeekEnding=nullable date, Week=nullable number, Year=nullable number, EndingInventoryAmount=nullable number, Index=number, Beg_Inv=number])}}),
  12. //Expand the subtables
  13. #"Expanded Starting" = Table.ExpandTableColumn(#"Grouped Rows", "Starting", {"WeekEnding", "Week", "Fiscal Year", "EndingInventoryAmount", "Index", "Beg_Inv"}),
  14. //Sort back to original order
  15. //Then remove the Index column and set the data types
  16. #"Sorted Rows" = Table.Sort(#"Expanded Starting",{{"Index", Order.Ascending}}), #"Removed Columns" = Table.RemoveColumns(#"Sorted Rows",{"Index"}), #"Changed Type1" = Table.TransformColumnTypes(#"Removed Columns",{{"StoreNumber", Int64.Type}, {"StoreName", type text}, {"DepartmentName", type text}, {"WeekEnding", type date}, {"Week", Int64.Type}, {"Year", Int64.Type}, {"EndingInventoryAmount", Int64.Type}, {"Beg_Inv", Int64.Type}}) in #"Changed Type1"
  17.  
  18.  
  19.  
  20. ERROR:
  21. The import Changed Type matches no exports. Did you miss a module reference?
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement