Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
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!
Solved! Go to 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.
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])))
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.
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!
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!
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
User | Count |
---|---|
42 | |
28 | |
23 | |
18 | |
15 |
User | Count |
---|---|
54 | |
35 | |
18 | |
18 | |
15 |