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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
J_H
New Member

Order text on x-axis

I'm trying to create a column chart (specifically 100% stacked column chart). The labels along my X-axis are sample names, however when I create a chart Power BI creates what appears to be a random order and doesn't follow the order of the data table. The sample names contain both numbers and letters so are inputted as text values, and selecting "Sort by column" doesn't help. If I remove the letters, leaving just numbers, it arranges it numerically (which is fine) but leaves massive gaps along the number line because the nature of the samples means they're not consecutive numbers.

I've also tried creating a column of numbers and using "Sort by column" to sort the sample name column by the number...but no luck. 

Suggestions?

 

3 REPLIES 3
GilbertQ
Super User
Super User

Hi there,

 

You could possibly create an Index Column in Power Query on your table.

 

And then use this Index Column as your "Sort By Column" on your field? That should then create it in the correct order.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

CheenuSing
Community Champion
Community Champion

@J_H

Capture.GIF

Is this what you are expecting or anything different. 

 

Cheers 

 

CheenuSing

I tried with my test table created based on your problem and i see the result as 

 

 

Did I answer your question? Mark my post as a solution and also give KUDOS !

Proud to be a Datanaut!

Thanks @CheenuSing

Yes, and my issue was I needed it in particular order e.g. Sample 1, 1Gsample, 20 Test etc. using your example.

However I've gotten it to work using the "Sort by column" function, which I'd tried before so I don't know why it suddenly decided to work, but it does.

In case anyone else needs it: highlight the column of your x-axis data and select "Sort by column" then choose the column of numbers which are in the desired order.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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