Forum Discussion
derekmac
Helper I
2 years agoMove Values to the Left in Columns Side by Sides, removing Nulls
Hi All I have a set of fields as below Manager4_Name Manager3_Name Manager2_Name Manager1_Name ReportingTo Fullname null null null null Jane Upton Nicole Peters null null ...
- 2 years ago
let Source = your_table, to_rows = List.Buffer(Table.ToRows(Source)), count = Table.ColumnCount(Source) - 1, txform = List.Transform( to_rows, (x) => [a = List.RemoveNulls(List.RemoveLastN(x, 1)), b = a & List.Repeat({null}, count - List.Count(a)) & {List.Last(x)}][b] ), z = Table.FromRows(txform, Table.ColumnNames(Source)) in z
AlienSx
Super User
2 years agolet
Source = your_table,
to_rows = List.Buffer(Table.ToRows(Source)),
count = Table.ColumnCount(Source) - 1,
txform = List.Transform(
to_rows,
(x) =>
[a = List.RemoveNulls(List.RemoveLastN(x, 1)),
b = a & List.Repeat({null}, count - List.Count(a)) & {List.Last(x)}][b]
),
z = Table.FromRows(txform, Table.ColumnNames(Source))
in
zderekmac
Helper I
2 years agoThanks a lot