0
데이터가있는 4 개의 Excel 통합 문서가 들어있는 "Link_StaffDataLocation"폴더를 찾는 PowerBI에서 쿼리를 만들려고했습니다. 이러한 통합 문서의 데이터는 부적절한 방식으로 구성되기 때문에 데이터를 재구성하여 단일 테이블에 추가하려고합니다.PowerBI 쿼리 지원이 필요합니다.
나는 아래에서 시도했다. 그것은 나에게 길의 일부를주는 것처럼 보인다. 그러나 그것은 첫 번째 통합 문서의 데이터 일 뿐이며, 나는 내 테이블에 4 번 이상 계속 들어갑니다.
나는 무엇을보고/이해하지 못합니까 ??
let
//Get data from file in folder
Source = Folder.Files(Link_StaffDataLocation),
#"Get the files" = Table.SelectRows(Source, each [Extension] = ".csv" or [Extension] = ".txt" or Text.StartsWith([Extension], ".xls")),
#"Removed Columns" = Table.RemoveColumns(#"Get the files",{"Date accessed", "Date modified", "Date created", "Attributes", "Folder Path"}),
GetExcelContentIntoColumn = Table.AddColumn(#"Removed Columns", "Custom", each if Text.StartsWith([Extension], ".xls") then Excel.Workbook([Content]) else null),
ExpandContent = Table.ExpandTableColumn(GetExcelContentIntoColumn, "Custom", {"Name", "Data", "Kind"}, {"Custom.Name", "Custom.Data", "Custom.Kind"}),
#"Filtered Rows" = Table.SelectRows(ExpandContent, each ([Custom.Name] = "BC Ongoing Projects")),
//Create files name list
FileNameListStep1 = Table.Column(#"Filtered Rows","Name"),
CurrentFilename = FileNameListStep1{0},
//Filter on first filename
IterationFunction = (CurrentFilename) =>
let
FilterOneDataSetAtATime = Table.SelectRows(#"Filtered Rows", each ([Name] = CurrentFilename)),
// Make necessary adjustments to data
#"Custom Data1" = #"Filtered Rows"{0}[Custom.Data],
#"Filtered Rows1" = Table.SelectRows(#"Custom Data1", each ([Column1] <> null and [Column1] <> "BC Ongoing Projects" and [Column1] <> "Filters Used To Select These Practitioners:" and [Column1] <> "Pract" and [Column1] <> "Scheduled Hours" and [Column1] <> "Total:")),
#"Removed Columns1" = Table.RemoveColumns(#"Filtered Rows1",{"Column5"}),
#"Replaced Value_DK" = Table.ReplaceValue(#"Removed Columns1","DK","",Replacer.ReplaceText,{"Column4"}),
#"Replaced Value_SE" = Table.ReplaceValue(#"Replaced Value_DK","SE","",Replacer.ReplaceText,{"Column4"}),
#"Replaced Value" = Table.ReplaceValue(#"Replaced Value_SE",null,0,Replacer.ReplaceValue,{"Column6", "Column7", "Column8", "Column9", "Column10", "Column11", "Column12", "Column13", "Column14", "Column15", "Column16", "Column17"}),
#"Changed Type" = Table.TransformColumnTypes(#"Replaced Value",{{"Column6", type text}, {"Column7", type text}, {"Column8", type text}, {"Column9", type text}, {"Column10", type text}, {"Column11", type text}, {"Column12", type text}, {"Column13", type text}, {"Column14", type text}, {"Column15", type text}, {"Column16", type text}, {"Column17", type text}}),
#"Promoted Headers" = Table.PromoteHeaders(#"Changed Type"),
//Create List of week dates
MondayInWeekStep1 = Table.ColumnNames(#"Promoted Headers"),
MondayInWeekStep2 = List.Skip(MondayInWeekStep1,4),
#"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Promoted Headers", {"Name", "Client", "Type", "Key"}, "MondayInWeek", "Staff Hours"),
ReOrganizedTable = Table.TransformColumnTypes(#"Unpivoted Columns",{{"MondayInWeek", type date}, {"Staff Hours", Int64.Type}}),
AddFilenameColumn= Table.AddColumn(ReOrganizedTable, "FileName", each CurrentFilename)
in
AddFilenameColumn,
ListOfTables = List.Transform(FileNameListStep1, (filename) => IterationFunction(filename)),
#"Converted to Table" = Table.FromList(ListOfTables, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandTableColumn(#"Converted to Table", "Column1", {"Name", "Client", "Type", "Key", "MondayInWeek", "Staff Hours", "FileName"}, {"Name", "Client", "Type", "EmployeeNr", "MondayInWeek", "Staff Hours", "FileName"})
in
#"Expanded Column1"
. 고맙습니다. – JSF