PQ Query references other queries

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.



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"
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top