Forum

Sorting individual ...
 
Notifications
Clear all

Sorting individual column in Power Query

3 Posts
2 Users
0 Reactions
179 Views
(@bluesky63)
Posts: 162
Estimable Member
Topic starter
 

Hi

not sure is it possible to achieve this in using power query,  had been attempting for a while however couldn't find a innovative way,  or probably to remove null in between and stack it up individually,   it can use excel way to achieve it with several ways (small, row, countA etc),  just curious if power query can do it too

 

Thank you !

 
Posted : 27/07/2020 11:04 am
(@catalinb)
Posts: 1937
Member Admin
 

There are no limits, you can do anything.

Here is an example:

let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
Headers = Table.ColumnNames(Source),
Columns = Table.ToColumns(Source),
Sort = List.Transform(Columns, each List.Sort(List.RemoveNulls(_), Order.Ascending)),
Tbl = Table.FromColumns(Sort,Headers)
in
Tbl

But...

The structure is wrong, you should use a tabular structure with expanding rows, not columns. Whenever you need to add new columns for new data, this is a good indicator that the structure is wrong. Should be:

Team Name
Team A David
Team A Jerry
Team A John
Team A Ronald
Team B Albert
Team B Andy
Team C Chris
Team C Jane
Team C Lawrence
 
Posted : 27/07/2020 11:49 pm
(@bluesky63)
Posts: 162
Estimable Member
Topic starter
 

Hi Catalin,   Thanks ! you are the expert

By the way,  table1 is taken from original source by users,  and usually they do not want to change the "Structure" and as long as it is able to use PQ, and it is more efficient than excel,  there is another option to achieve what they want...

 

Thank you very much !

 
Posted : 28/07/2020 7:34 am
Share: