Forum Discussion
Anonymous
3 years agoNot applicable
replace row value in nested table based on condition in power query
Could anyone suggest for below query please? I have source columns Material, Plant and Flag Status · Required to build new column in power query nested table · Logic: o If Group of material b...
- 3 years ago
let // replace your_table with correct reference to your original data Source = your_table, f = (tbl as table) as table => [a = List.Contains(tbl[Flag Status], "No Phase out"), b = Table.AddColumn(tbl, "new flag", (x) => if (Text.Start(x[Plnt], 1) = "A" and a) then "No Phase out" else x[Flag Status])][b], gr = Table.Group(Source, "Material", {{"all", each f(_)}}), expand = Table.ExpandTableColumn(gr, "all", {"Plnt", "Flag Status", "new flag"}) in expand
Mahesh0016
Super User
3 years agolet
Source = #"Table Phase",
f = (tbl as table) as table =>
[a = List.Contains(tbl[Flag Status], "No Phase out"),
b = Table.AddColumn(tbl, "new flag", (x) => if (Text.Start(x[Plnt], 1) = "A" and a) then "No Phase out" else x[Flag Status])][b],
gr = Table.Group(Source, "Material", {{"all", each f(_)}}),
expand = Table.ExpandTableColumn(gr, "all", {"Plnt", "Flag Status", "new flag"})
in
expand
Anonymous I hope this helps you!Thank You!!