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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Gnanasekar
Helper III
Helper III

Number sorting in text format

Hi All,

 

A column in power bi report contained two datatypes data (Number & Text)

Test:

1 , 22, 2,178, 3, Red, 10, 20, 30, Yellow, 100, 110,  200, 250,  Green

 

If I convert number (Decimal or Whole)  data type 'Red, Yellow, Green' will be gone (or) get error. So I changed text datatype

in text datatype If I sort Test columnit was coming order like

1

10

100

110

178

2

20

22

200

250

3

30

Green

Red

Yellow

(or reversed of this order)

it was ordering based on letter.

But I need order based on value ( Like 1,2,3,10,20,22,30,100,...Green, Red, Yellow)

 

By

Gnanasekar

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @Gnanasekar,

 

Taking into account that you need the values by order you can always add a column with the following formula:

Sort_Order =
IF (
    NOT ( ISERROR ( 'Table'[Column] + 0 ) )
        = TRUE ();
    CONCATENATE ( REPT ( 0; 4 - LEN ( 'Table'[Column] ) ); 'Table'[Column] );
    'Table'[Column]
)

Then use this column to sort out the visual.

 

Regards,

MFelix


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português





View solution in original post

10 REPLIES 10
MFelix
Super User
Super User

Hi @Gnanasekar,

 

Taking into account that you need the values by order you can always add a column with the following formula:

Sort_Order =
IF (
    NOT ( ISERROR ( 'Table'[Column] + 0 ) )
        = TRUE ();
    CONCATENATE ( REPT ( 0; 4 - LEN ( 'Table'[Column] ) ); 'Table'[Column] );
    'Table'[Column]
)

Then use this column to sort out the visual.

 

Regards,

MFelix


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português





Hello, what if I have both negative and positive value? How can I use this method properly?

I think you need to add a column and just write like this:

Sort_Order = VALUE([Data])

Hi @MFelix , 

 

I tried this formula and an error popped up: A circular dependency was detected

@MFelix An argument of function 'REPT' has the wrong data type or has an invalid value.

Hi @Digger,

 

Can you share the formula you are using?

  •  

Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português





@MFelix Problem is 

LEN ( 'Table'[Column] )

is > than 4 

Hi @Digger what type of data you have on this column? Can you share some sample data


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português





What is the text you want to combine can you give a sample? 


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português





@MFelix Problem is 

LEN ( 'Table'[Column] )

is > than 4 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.