Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now
Hi,
Is it possible in Query Editor to split the below text column into 2.
I'd like 1 column to contain the numbers (highlighted in blue in pic below) & the other column to contain the text (highlighted in red).
Solved! Go to Solution.
Hi @Qotsa ,
Did you mean extract text value from list? If this is a case, you can try to use following formula:
#"Added Custom" = Table.AddColumn(#"Changed Type", "Number", each try if Number.From([Column1]) <> null then null else [Column1] otherwise [Column1])
Full query:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjI2MTJRitWJVjI0NtIztQAzjY1MjIxDXMHslFSQYCwA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}}), #"Added Custom" = Table.AddColumn(#"Changed Type", "Number", each try if Number.From([Column1]) <> null then null else [Column1] otherwise [Column1]) in #"Added Custom"
Regards,
Xiaoxin Sheng
Hi @Qotsa ,
Did you mean extract text value from list? If this is a case, you can try to use following formula:
#"Added Custom" = Table.AddColumn(#"Changed Type", "Number", each try if Number.From([Column1]) <> null then null else [Column1] otherwise [Column1])
Full query:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjI2MTJRitWJVjI0NtIztQAzjY1MjIxDXMHslFSQYCwA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}}), #"Added Custom" = Table.AddColumn(#"Changed Type", "Number", each try if Number.From([Column1]) <> null then null else [Column1] otherwise [Column1]) in #"Added Custom"
Regards,
Xiaoxin Sheng
Hi @Qotsa
What exactly would your expected result look like?
You could add two custom columns, one with the rows with numbers and nulls elsewhere and another one with the text rows and nulls elsewhere. Something like this. Note 'Column1' is the name of the column in the original table. Update that if required.
let Source = PLACE HERE YOUR SOURCE , #"Added Custom" = Table.AddColumn(Source, "Numbers", each if Text.Remove([Column1],{"0".."9", ","})="" then [Column1] else null), #"Added Custom1" = Table.AddColumn(#"Added Custom", "Text", each if Text.Remove([Column1],{"0".."9", ","})<>"" then [Column1] else null), #"Changed Type" = Table.TransformColumnTypes(#"Added Custom1",{{"Numbers", type number}, {"Text", type text}}) in #"Changed Type"
You could remove the original column at the end if you need to.
Check out the October 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
114 | |
95 | |
86 | |
78 | |
66 |
User | Count |
---|---|
150 | |
118 | |
111 | |
106 | |
95 |