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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
carlosagarcia
Helper I
Helper I

Sorting a range of number and letters

Good morning everyone, 

 

I am looking for a way to divide inventory locations into zones.

Our inventory locations start with row 0, shelf A, bin 1, example 0A1. each shelf has 5 bins, the shelfs go from A to J and we have 70 rows.

 

0A5  0B5

0A4  0B4

0A3  0B3  and so on until shelf J

0A2  0B2

0A1  0B1

 

Then

 

1A5  1B5

1A4  1B4

1A3  1B3  and so on until shelf J

1A2  1B2

1A1  1B1

 

When I sort by location, the result is row 0 first then I get all the 10s, 11s and so on until I get row 1, then all the 20s before I get to row 2.

 

I am looking for a way to create inventory zones where...

 

Zone 1 are rows  everything in between 0A1 to 6J5

Zone 2 are rows everything in between 7A1 to 11J5

Zone 3 are rows everything in between 12A1 to 15J5 and so on.

 

Will this be possible?

 

 

 

 

 

1 ACCEPTED SOLUTION

Hello @carlosagarcia 

have you had the chance to review my solution? Thank you

View solution in original post

8 REPLIES 8
Anonymous
Not applicable

Hi @carlosagarcia ,

In order to give you a suitable solution faster, could you please provide some sample data(exclude sensitive data) and the final result you want? And give examples of the sorting rules involved. If possible, a sample pbix file would be better. Thank you.

Best Regards

tamerj1
Super User
Super User

Hi @carlosagarcia 
It is doable. Please confirm on which order you need the result to be.

Your zones end 15J5, what about the rest? 
Please share sample file it available.

Hi @carlosagarcia 
Here is a sample file with the proposed solution https://www.dropbox.com/t/kdaoTHJT66w4n9vH
In the sample file I used DX code to generate a separate rows (Row, Shelf & Bin) but you can conveniently use Power Query (Add Column - From Example ) to do the same. Once the columns are seperate you can use DAX to create a new "Sorting by column" 

 

Sort By Number = 
VAR Shelves = 
    SWITCH ( TRUE, [Shelf] = "A", 1, [Shelf] = "B", 2, [Shelf] = "C", 3, [Shelf] = "D", 4, [Shelf] = "E", 5, [Shelf] = "F", 6, [Shelf] = "G", 7, [Shelf] = "H", 8, [Shelf] = "I", 9, [Shelf] = "J", 10 )
VAR Result =
    [Row] + Shelves * 100 + [Bin] * 10000
RETURN
    Result

 

Last step: select the location and from Column Tools - Sort By Column select the new column.
1.png
2.png
Please let me know if you need to create hierarchy and group by Zones. Thank you!

Hello @carlosagarcia 

have you had the chance to review my solution? Thank you

Tamerj1,

I am so sorry I did not see your response, I just did a quick reply, let me test it right now.

amitchandak
Super User
Super User

@carlosagarcia , Try a new column like

first concert you column to 4 digit

column = format([Your column], "0000")

 

then

 

Switch( True() ,

[column] >= "00A1" &&  [column]  <= "06J5", "Zone 1" ,

[column] >= "07A1" &&  [column]  <= "11J5", "Zone 2" ,

[column] >= "12A1" &&  [column]  <= "15J5", "Zone 3" )

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hello Ami, have you been able to review my question?

Hello Ami,

 

I cant get the new column to have 4 digits.

Looks like it is formated to text.

 

carlosagarcia_1-1645549915644.png

 

So the second part does not pick up the changes 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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