Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I have a column formated as text with 2 types of data. 1) 12345 and 2) AB123. Now I am looking for a way to have in another column the Values of 1 as values and the first 2 letters of 2 as text. It is needed to make a connection to another table in which the values and the letters are connected to cities.
An idea is welcome.
Solved! Go to Solution.
My solution was:
to get the value in a new Column:
Hi @Anonymous
If i understand you correct, you want
column -> column1 column2
12345 12345 AB
AB123
If so, in Edit queries,
1. add two column
2.Replace errors with null
3.add conditional column
4.Fill down for "Custom" column
5.Filter Rows which is null for 'Custom.1"
6. remove columns
Then Whole code in Advanced editor
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQyNjFVitWJVnJ0ArLBLEMjE1MzMMvZBchWio0FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [column = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"column", type text}}), #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each Number.FromText([column])), #"Inserted First Characters" = Table.AddColumn(#"Added Custom", "First Characters", each Text.Start([column], 2), type text), #"Replaced Errors" = Table.ReplaceErrorValues(#"Inserted First Characters", {{"Custom", null}}), #"Added Conditional Column" = Table.AddColumn(#"Replaced Errors", "Custom.1", each if [Custom] = null then 1 else null), #"Filled Down" = Table.FillDown(#"Added Conditional Column",{"Custom"}), #"Filtered Rows" = Table.SelectRows(#"Filled Down", each [Custom.1] <> null and [Custom.1] <> ""), #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"column", "Custom.1"}) in #"Removed Columns"
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
My solution was:
to get the value in a new Column:
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
97 | |
85 | |
70 | |
61 |
User | Count |
---|---|
151 | |
120 | |
103 | |
87 | |
68 |