Forum Discussion
Jpalaci1
Jan 15, 2021Brass Contributor
Stuck in PQ and not sure how to achieve next steps
Hi, I need some help with a Power Query query. I’ve got stuck in the middle somewhere and have been Googling and searching and hit a roadblock. I know the exact output I want but not sure how to get ...
SergeiBaklan
Jan 15, 2021Diamond Contributor
One more variant
let
Source = Excel.CurrentWorkbook(){[Name="Table2"]}[Content],
#"Kept First Rows" = Table.FirstN(
Source,
List.PositionOf(Source[Column1],"TOTALS (USD)")
),
#"Removed Columns" = Table.RemoveColumns(#"Kept First Rows",{"Total"}),
#"Filtered Rows" = Table.SelectRows(#"Removed Columns", each ([Column1] <> null)),
#"Replaced Value1" = Table.ReplaceValue(
#"Filtered Rows",
each [Column1],
each
if Value.Type([Column1]) = type text
then [Column1]
else null,
Replacer.ReplaceValue,{"Column1"}
),
#"Split Column by Delimiter" = Table.SplitColumn(
Table.TransformColumnTypes(
#"Replaced Value1",
{{"Column1", type text}}, "en-US"),
"Column1",
Splitter.SplitTextByEachDelimiter({","}, QuoteStyle.Csv, false
),
{"Employee Number", "Name"}
),
#"Replaced Value" = Table.ReplaceValue(
#"Split Column by Delimiter",
" (USD)","",
Replacer.ReplaceText,{"Name"}
),
#"Filled Down" = Table.FillDown(
#"Replaced Value",
{"Employee Number", "Name"}
)
in
#"Filled Down"