Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I have seen all the example of how to change the text by assigning a value a number by adding a column or using SWITCH but these examples assume you know the values ahead of time.
How would you do this if a given text column's data is unknown but many cells are identical?
Can you search and assign a unique number to each different cell value?
i.e. - Beta = 1, Prod = 2....but those names may be different the next time.
Solved! Go to Solution.
Hi @jgpbi ,
According to your description, here are my steps you can follow as a solution.
(1)My test data is the same as yours.
(2) We can create a calculated column.
Column = RANKX('Table','Table'[Cluster],,ASC,Dense)
(3) Then the result is as follows.
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
That worked perfectly. I had to do it via the Data View - New Column.
I still don't understand why certain functions to create a column only work from Data View - New Column and not from Transform Data - Add Column.
Hi @jgpbi ,
Click "transform data" to enter the power query editor, click "Advanced Editor" to copy and paste the following content, please check the steps from the right column, if you need to change the data source, please change the data source directly in the first step, and then go to the last step.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcnINcVSK1cHGCAjyd8HD0HUMCNANd3WiroALfnZJanFJYiI2ZlKSUmwsAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Cluster = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Cluster", type text}}),
#"Removed Duplicates" = Table.Distinct(#"Changed Type"),
#"Added Index" = Table.AddIndexColumn(#"Removed Duplicates", "Index", 1, 1, Int64.Type)
in
#"Added Index"
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @jgpbi ,
According to your description, here are my steps you can follow as a solution.
(1)My test data is the same as yours.
(2) We can create a calculated column.
Column = RANKX('Table','Table'[Cluster],,ASC,Dense)
(3) Then the result is as follows.
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
70 | |
64 | |
51 | |
39 | |
26 |
User | Count |
---|---|
86 | |
55 | |
44 | |
42 | |
36 |