Forum Discussion
Anonymous
3 years agoNot applicable
Create a dynamic row for the table in Power query based on the column value
Hello all, I have an invoice report which has the data in .csv file. I am importing this csv file into power bi to create reports. The table structure of the file is as below. Total amo...
kirete17
3 years agoFrequent Visitor
Custom1 =
List.TransformMany(
Table.ToRows( PreStep ),
each
let
l = List.Range( _, 4, List.Count( _ ) - 5 ),
c = List.Skip( Table.ColumnNames( PreStep ), 4 )
in
List.Transform(
List.Positions( l ),
(x)=> { Text.BeforeDelimiter( c{x}, " " ) } & List.Repeat( {null}, x ) & { l{x} } & List.Repeat( {null}, List.Count( l ) -x -1 ) & { l{x} }
),
(x,y)=> List.FirstN( x, 2 ) & {y{0}, x{3} } & List.Skip( y )
),
Custom2 =
Table.FromRows( Custom1, Table.ColumnNames( PreStep ) )