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.
Hi!
I have a column in my raw data with item names in it, like this:
WID S 56*45
S 36*7
S56*27
QVJE S 36*14L
Is there a way to extract from that column the text before and after "*"? so that the result from the above would be:
S 56*45
S 36*7
S56*27
S 36*14L
BR
Kaj
Solved! Go to Solution.
@Kaizu80,
Add a blank query in your PBIX file, then paste the following code to Advanced Editor of the blank query.
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCvd0UQhWMDXTMjFVitWJVgpWMDbTMocwgaJGEGZgmJerAljK0MRHKTYWAA==", 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}}), #"Split Column by Delimiter" = Table.SplitColumn(#"Changed Type", "Column1", Splitter.SplitTextByDelimiter("*", QuoteStyle.Csv), {"Column1.1", "Column1.2"}), #"Added Custom1" = Table.AddColumn(#"Split Column by Delimiter", "Custom.1", each if Text.Start([Column1.1], 1)="S" then [Column1.1] else Text.End([Column1.1], Text.PositionOf([Column1.1], "S"))), #"Added Custom" = Table.AddColumn(#"Added Custom1", "Custom", each [Custom.1] & "*" & [Column1.2]) in #"Added Custom"
Regards,
Lydia
@Kaizu80,
Add a blank query in your PBIX file, then paste the following code to Advanced Editor of the blank query.
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCvd0UQhWMDXTMjFVitWJVgpWMDbTMocwgaJGEGZgmJerAljK0MRHKTYWAA==", 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}}), #"Split Column by Delimiter" = Table.SplitColumn(#"Changed Type", "Column1", Splitter.SplitTextByDelimiter("*", QuoteStyle.Csv), {"Column1.1", "Column1.2"}), #"Added Custom1" = Table.AddColumn(#"Split Column by Delimiter", "Custom.1", each if Text.Start([Column1.1], 1)="S" then [Column1.1] else Text.End([Column1.1], Text.PositionOf([Column1.1], "S"))), #"Added Custom" = Table.AddColumn(#"Added Custom1", "Custom", each [Custom.1] & "*" & [Column1.2]) in #"Added Custom"
Regards,
Lydia
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 |
---|---|
69 | |
68 | |
40 | |
29 | |
26 |
User | Count |
---|---|
88 | |
49 | |
45 | |
38 | |
37 |