millhouse123
Active Member
- Joined
- Aug 22, 2006
- Messages
- 335
I have a number of queries one of which is shown below.. When I refresh these queries they work perfect but when my co-worker tries to run the same ones they get an error that the query references other queries or steps. I have seen this error before but I don't understand why they would get that error and I would not. The error seems to be at the Merge queries line.
Any help shedding light on this would be much appreciated.
Any help shedding light on this would be much appreciated.
Code:
let
Source = Excel.Workbook(File.Contents(fnGetParameter1("Holdings")), null, true),
Sheet1 = Source{[Name="Sheet1"]}[Data],
#"Changed Type1" = Table.TransformColumnTypes(Sheet1,{{"Column1", type text}, {"Column2", type text}, {"Column3", type text}, {"Column4", type text}, {"Column5", type text}, {"Column6", type text}, {"Column7", type text}, {"Column8", type number}, {"Column9", type number}, {"Column10", Int64.Type}}),
#"Promoted Headers" = Table.PromoteHeaders(#"Changed Type1", [PromoteAllScalars=true]),
#"Renamed Columns1" = Table.RenameColumns(#"Promoted Headers",{{"Amounts Received", "CUSIP"}, {"Increase n Book Value", "Description"}, {"Book Value", "Actual Cost"}, {"Decrease in Book Value", "Book Value"}, {"Due & Accrued Bonds in Default", "Par Value"}, {"Due & Accrued", "Amount Received"}, {"Column8", "Increase in Book Value"}, {"Column9", "Decrease in Book Value"}, {"Column10", "Due & Accrued Bonds In Default"}, {"Actual Cost", "Due & Accrued"}}),
#"Added Conditional Column" = Table.AddColumn(#"Renamed Columns1", "Custom", each if [CUSIP] = null then [Description] else null ),
#"Filtered Rows1" = Table.SelectRows(#"Added Conditional Column", each true),
#"Filled Up" = Table.FillUp(#"Filtered Rows1",{"Custom"}),
#"Merged Queries" = Table.NestedJoin(#"Filled Up",{"Custom"},Table1,{"Exclude"},"NewColumn",JoinKind.LeftOuter),
#"Expanded NewColumn" = Table.ExpandTableColumn(#"Merged Queries", "NewColumn", {"Exclude"}, {"NewColumn.Exclude"}),
#"Renamed Columns" = Table.RenameColumns(#"Expanded NewColumn",{{"Custom", "Company"}}),
#"Filtered Rows2" = Table.SelectRows(#"Renamed Columns", each ([NewColumn.Exclude] = null)),
#"Added Custom" = Table.AddColumn(#"Filtered Rows2", "Custom", each Text.Length([CUSIP])),
#"Filtered Rows" = Table.SelectRows(#"Added Custom", each [Custom] = 9),
#"Changed Type" = Table.TransformColumnTypes(#"Filtered Rows",{{"Book Value", type number}, {"Par Value", type number}, {"Actual Cost", type number}, {"Due & Accrued", type number}, {"Amount Received", type number}, {"Increase in Book Value", type number}, {"Decrease in Book Value", type number}, {"Due & Accrued Bonds In Default", type number}}),
#"Added Custom1" = Table.AddColumn(#"Changed Type", "Amortization", each [Increase in Book Value]-[Decrease in Book Value]),
#"Grouped Rows" = Table.Group(#"Added Custom1", {"CUSIP"}, {{"Book Value", each List.Sum([Book Value]), type number}, {"Par Value", each List.Sum([Par Value]), type number}, {"Due & Accrued", each List.Sum([#"Due & Accrued"]), type number}, {"Amount Received", each List.Sum([Amount Received]), type number}, {"Amortization", each List.Sum([Amortization]), type number}, {"Due & Accrued Bonds in Default", each List.Sum([#"Due & Accrued Bonds In Default"]), type number}})
in
#"Grouped Rows"