Forum Discussion
majdkaid22
Helper V
9 years agoReorder columns in Query Editor without listing the column names
Hi guys, am doing union dax for 10 tables. While the process is easy, my columns in each table are not in the same order. In power Query, all the columns in 10 tables are in the exact same o...
- 9 years ago
hi majdkaid22,
You may reorder your columns in power query alphabetically using a custom code.
=Table.ReorderColumns( NameOfPreviousStep, List.Order( Table.ColumnNames( NameOfPreviousStep ), Order.Ascending )
zuludogm
Advocate II
5 years agoThere may have been a change to power query, but danextian's (excellent) solution would now be:
=Table.ReorderColumns( NameOfPreviousStep, List.Sort( Table.ColumnNames( NameOfPreviousStep ), Order.Ascending ) )
- Anonymous5 years agoNot applicable
I get Expression.SyntaxError: Token Eof expected when using this code
- zuludogm5 years ago
Advocate II
Hey - perhaps I made a copy/paste error, but here is exactly how I have applied it today:
= Table.ReorderColumns( #"Renamed Columns", List.Sort( Table.ColumnNames( #"Renamed Columns" ), Order.Ascending ) )
When I used the the original from danextian, I also for a syntax/EOF error because it is missing a closing parenthesis, so in my version, I added it. Also, as indicated, I changed List.Order to List.Sort.
- Anonymous4 years agoNot applicable
Brilliant, very much thanks
Regards,
F.