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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

Convert numbers into text

Hi, I have a column with 4 different numbers, lets call them 1111, 2222, 3333, 4444. For a diagram, I want them to be named, e.g. for 1111, should be named AAAA, 2222 should be named BBBB etc.

 

What is the best way to do it? Is it with a convert()? Couldn't figure it out yet.

 

Thanks for any help!

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

What is the logic to give the names ?

If you have it mapped in another table, you can just merge both tables and use this column.



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

Proud to be a Super User!



View solution in original post

7 REPLIES 7
camargos88
Community Champion
Community Champion

Hi @Anonymous ,

 

This is an Power Query solution using custom column:

 

let
_char = {"A".."Z"},
_value = Number.FromText(Text.Start(Number.ToText([Column1]), 1)) - 1
in Text.Repeat(_char{_value}, Text.Length(Text.From([Column1])))

 

Capture.PNG

 



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

Proud to be a Super User!



Anonymous
Not applicable

Hi @camargos88 ,

 

thanks for that solution. It unfirtunatley also didn't worked out. Power Bi shows "error" in every row of the column.

As far as I understand your formula, I would say it is maybe not the right approach. But I'm not sure.

 

To make it more clear:

I have a column with four different numbers, that are in there.

 

like

 

Column1

1111

1111

3333

2222

1111

4444

2222

 

and I want to give every specific number of that four numbers, the right name.

 

Like for example: 1111 is Steven, 2222 is Christoph, 3333 is Larry, 4444 is Magdalen

 

So it should look like this:

 

Column1          Column2

1111                  Steven

1111                  Steven

3333                   Larry

2222                  Christoph

 

etc.

 

 

Hi @Anonymous ,

 

What is the logic to give the names ?

If you have it mapped in another table, you can just merge both tables and use this column.



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

Proud to be a Super User!



Anonymous
Not applicable

Thank you. Since I had just 4 names to merge with the numbers it was easy to make a seperate table and merge it with the other one.

I made it more complicated than needed.

Thanks for the solution @camargos88 worked out perfect!

harshnathani
Community Champion
Community Champion

HI @Anonymous ,

 

 

Create a Calculated Column.


Column = 
SWITCH(
TRUE(),
'Table'[Column] = 1111 , "AAAA",

'Table'[Column] = 2222 , "BBBB",

'Table'[Column] = 3333 , "CCCC",

'Table'[Column] = 4444 , "DDDD"

)

 


Regards,

Harsh Nathani


Appreciate with a Kudos!! (Click the Thumbs Up Button)

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

Anonymous
Not applicable

Hi @harshnathani,

 

thanks for that solution. It unfortunatley didn't worked out. Power Bi shows me the following message:

 

DAX comparisons do not support comparisons between text and integer values. You can use the VALUE function or the FORMAT function to convert one of the values.

But I think this is in general the right way to do it!

 

 

HI @Anonymous ,

 

 

What is the Data Type of 1111 ?? Is it Text or Integer.

 

Pls check and let me know.

 

Can you share a screen shot if your table.

 

Regards,

Harsh Nathani

 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors