Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago

Adding a column into combined data

HI

I'm drawing in data from 10 schools. Each school creates a csv report that has the school name as the filename and is placed in a named folder. So in this case for the report i'm working on its achievement. each school runs the achievement report and puts the csv that is named by their school in the achievement folder. Power bi then gets all csvs in said folder and combines it to makes one set of data. Works great but i can't figure out how to add in a new column. I know how to do it for a single csv just not multiple csvs that combine. 

In all the reports from each school i've added a new column how do i show this in power bi

 

Source = SharePoint.Contents("*****"),
Documents = Source{[Name="Documents"]}[Content],
#"*****************" = Documents{[Name="***************"]}[Content],
#"School Data" = #"***************"{[Name="School Data"]}[Content],
Achievement1 = #"School Data"{[Name="Achievement"]}[Content],
#"Filtered Hidden Files1" = Table.SelectRows(Achievement1, each [Attributes]?[Hidden]? <> true),
#"Invoke Custom Function1" = Table.AddColumn(#"Filtered Hidden Files1", "Transform File (12)", each #"Transform File (12)"([Content])),
#"Renamed Columns1" = Table.RenameColumns(#"Invoke Custom Function1", {"Name", "Source.Name"}),
#"Removed Other Columns1" = Table.SelectColumns(#"Renamed Columns1", {"Source.Name", "Transform File (12)"}),
#"Expanded Table Column1" = Table.ExpandTableColumn(#"Removed Other Columns1", "Transform File (12)", Table.ColumnNames(#"Transform File (12)"(#"Sample File (12)"))),
#"Changed Type" = Table.TransformColumnTypes(#"Expanded Table Column1",{{"Source.Name", type text}, {"External Id", type text}, {"Achievement Type", type text}, {"Achievement Points", Int64.Type}, {"Achievement Date", type date}}),
#"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"Source.Name", "School Name"}}),
#"Replaced Value" = Table.ReplaceValue(#"Renamed Columns",".csv","",Replacer.ReplaceText,{"School Name"})

 

 
 

thanks

1 Reply

  • If it is the same column for all files then just add it to the end of your script. What do you want the new column to do?