Newly added column in cvs source data (combined folder) - not appearing when refreshing in power query section in Power BI

Viewed 350

Still stumbling my way through Power BI.
I have added a new column in just a few of the files in the folder that I had already pulled in and combined but this column is not appearing once refreshed. Despite the endless research, I am at a loss as to how to fix this in advanced editor. Your assistance would be greatly appreciated.
Code below:

Source = Folder.Files("C:\Users\Sarah\OneDrive\FEEDLOT\APS Files\Original Files"),
    #"Filtered Hidden Files1" = Table.SelectRows(Source, each [Attributes]?[Hidden]? <> true),
    #"Invoke Custom Function1" = Table.AddColumn(#"Filtered Hidden Files1", "Transform File", each #"Transform File"([Content])),
    #"Renamed Columns1" = Table.RenameColumns(#"Invoke Custom Function1", {"Name", "Source.Name"}),
    #"Removed Other Columns1" = Table.SelectColumns(#"Renamed Columns1", {"Source.Name", "Transform File"}),
    #"Removed Errors1" = Table.RemoveRowsWithErrors(#"Removed Other Columns1", {"Transform File"}),
    #"Expanded Table Column1" = Table.ExpandTableColumn(#"Removed Errors1", "Transform File", Table.ColumnNames(#"Transform File"(#"Sample File"))),
    #"Changed Type" = Table.TransformColumnTypes(#"Expanded Table Column1",{{"Source.Name", type text}, {"Tag Number", type text}, {"Electronic ID", type text}, {"NLIS", type any}, {"Date", type datetime}, {"Live Weight (kg)", type number}, {"Draft", type any}, {"Condition Score", type any}, {"Notes", type any}}),
    #"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"Source.Name", "APS Source File Name"}, {"Tag Number", "Visual ID"}}),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Renamed Columns", "APS Source File Name", Splitter.SplitTextByEachDelimiter({"-"}, QuoteStyle.Csv, true), {"APS Source File Name.1", "APS Source File Name.2"}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"APS Source File Name.1", type text}, {"APS Source File Name.2", type text}}),
    #"Removed Columns" = Table.RemoveColumns(#"Changed Type1",{"APS Source File Name.2"}),
    #"Renamed Columns2" = Table.RenameColumns(#"Removed Columns",{{"APS Source File Name.1", "APS Source File Name"}})
2 Answers

Don't try to fix this in Advanced Editor alone. Instead, step through the code and inspect the result after each step. That will show you where the problem is.

Without seeing your data it is not possible to tell you where in your code you need to make changes, but you will be able to see that if you step through the actions one by one.

First of all, check twice you are reading the correct file and backup the current script. Then, I would try two approaches:

  1. Delete the steps until you find the one that causes the problem. Then, fix the step causing the issue and check if at the end of the pipeline the columns appear.

If this does not solve the issue, I would go with the second approach:

  1. Create a new PBIX, and one-by-one re-implement all the steps until you find the one causing the new columns to disappear.
Related