Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
davidz106
Helper III
Helper III

Sort column headers from left to right based on number

I have a table with 20 fields. Last x fields are numbers (0, 10, 15, 20, 5). 

 

I expand my table via list function (since I don't know numbers in advance) by typing:

ColNames= Table.ColumnNames ( Table.Combine ( #"Last"[Data] ) ),
Expand1 = Table.ExpandTableColumn ( #"Last", "Data", ColNames ),

 

I want my numbers sorted from left to right by increasing order. List would mix then (5 is at the end etc). How would I be able to achieve that?

2 REPLIES 2
amitchandak
Super User
Super User

@davidz106 ,The information you have provided is not making the problem clear to me. Can you please explain with an example.

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
Appreciate your Kudos.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

I first build a list "Colnames" of All columns in my file. 

 

Sample is: 

A

B

C

D

5

10

0

25

15

 

A B C D are always the same but numbers aren't (numers are not always the same). I would like to sort numbers in increasing order 0->100 and then expand to table but I cannot do that since sorting in list would put number 5 in last place. 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors