Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
I would like to perform the Text.AfterDelimiter() function on a column [COLUMN_B] but only when [COLUMN_A] contains specific text: "No Producer - Direct"
Also I want this action to occure within column b, not into a new column 🙂
Desired result:
[COLUMN_A] [COLUMN_B]
No Producer - Direct,SampleA SampleA
No Producer - Direct,SampleB SampleB
No Producer - Direct,SampleC SampleC
ABC ABC
Direct, SampleD Direct, SampleD
Solved! Go to Solution.
Hi @Anonymous
You can try this:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8stXCCjKTylNTi1S0FVwySxKTS7RCU7MLchJdVSK1cGrwImQAmewAkcn50MLDi0As6HSChB5F6XYWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [COLUMN_A = _t]),
#"Added Custom" = Table.AddColumn(Source, "Custom", each if Text.Contains([COLUMN_A],"No Producer - Direct") then Text.AfterDelimiter([COLUMN_A], ",") else [COLUMN_A]),
#"Renamed Columns" = Table.RenameColumns(#"Added Custom",{{"Custom", "COLUMN_B"}})
in
#"Renamed Columns"
Here is the output:
The pbix is attached.
Best Regards,
Link
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous,
Did my solution help you solve your problem?
If the solution helps then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Link
Hi @Anonymous
You can try this:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8stXCCjKTylNTi1S0FVwySxKTS7RCU7MLchJdVSK1cGrwImQAmewAkcn50MLDi0As6HSChB5F6XYWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [COLUMN_A = _t]),
#"Added Custom" = Table.AddColumn(Source, "Custom", each if Text.Contains([COLUMN_A],"No Producer - Direct") then Text.AfterDelimiter([COLUMN_A], ",") else [COLUMN_A]),
#"Renamed Columns" = Table.RenameColumns(#"Added Custom",{{"Custom", "COLUMN_B"}})
in
#"Renamed Columns"
Here is the output:
The pbix is attached.
Best Regards,
Link
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous
You need to add an IF condition to check if "No Producer - Direct" exists then perform Text.AfterDelimite function as follows. I am adding a new column with this condition
if Text.Contains([COLUMN_A],"No Producer - Direct") then Text.AfterDelimiter([COLUMN_B], ",") else null
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
User | Count |
---|---|
124 | |
108 | |
99 | |
62 | |
62 |
User | Count |
---|---|
137 | |
115 | |
102 | |
71 | |
61 |