Forum Discussion
ngct1112
4 years agoPost Patron
Filter Columns based on columns' name
Hi all, May I ask is there any way I could filter columns based on its name? ID Group Cost 1 Cost 2 Price 1 Price 2 1 A - 0.8 - -0.11 2 B 0.4 - - 0.23 3 - 0.5 - 0....
- 4 years ago
= let col=List.Select(Table.ColumnNames(Source), each Text.Contains(_,"Price")) in Table.SelectRows(Source, each List.PositionOf(Record.ToList(Record.SelectFields(_,col)),"-")<0)
wdx223_Daniel
4 years agoCommunity Champion
= let col=List.Select(Table.ColumnNames(Source), each Text.Contains(_,"Price")) in Table.SelectRows(Source, each List.PositionOf(Record.ToList(Record.SelectFields(_,col)),"-")<0)- ngct11124 years agoPost Patron
wdx223_Daniel may I have a further question?
Is it possible to achieve a similar outcome:
When the Columns name contains "price" then Change "Type number"
Great thanks if you have any idea!
- wdx223_Daniel4 years agoCommunity Champion
=Table.TransformColumnTypes(PreviousStep,List.Transform(List.Select(Table.ColumnNames(PreviousStep),each Text.Contains(_,"price")),each {_,type number}))