The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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.