Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
Hi there,
In new custom column i wanted to write syntax as if column [sec_name] contains ABC corp 1 then populate ABC else NA.
can someone please help me with syntax which will work in PowerBI transform view.
I tried :- IF [sec_name] contains "ABC Corp 1" then "ABC" else "NA"
Solved! Go to Solution.
Hi @Bansi008 ,
Thank you for @anmolmalviya05 and @daircom answer , and I have other suggestions for you:
Below is my table:
I try this expression:
= Table.AddColumn(#"Changed Type", "Custom", each if Text.Contains([sec_name], "ABC corp 1") then "ABC" else "NA")
The final output is shown in the following figure:
If this doesn't work, please provide a screenshot of the error
Best Regards,
Xianda Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
In the last argument of the Text.Contains function, specify Comparer.OrdinalIgnoreCase to perform a non case sensitive search. Read here - Text.Contains - PowerQuery M | Microsoft Learn
Hi @Bansi008 ,
Thank you for @anmolmalviya05 and @daircom answer , and I have other suggestions for you:
Below is my table:
I try this expression:
= Table.AddColumn(#"Changed Type", "Custom", each if Text.Contains([sec_name], "ABC corp 1") then "ABC" else "NA")
The final output is shown in the following figure:
If this doesn't work, please provide a screenshot of the error
Best Regards,
Xianda Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi both,
unfortunately this solution doesn't work
Hi @Bansi008, Hope you are doing good !
To create a custom column in Power BI's Power Query Editor that checks if the sec_name column contains the string "ABC Corp 1" and then populates "ABC" if true, or "NA" otherwise, you can use the following syntax in M language:
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !!
Hi @Bansi008 ,
You need the functon Text.Contains (watch out, it is case sensitive).
So:
if Text.Contains([sec_name], "ABC Corp 1") then "ABC" else "NA"
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 56 | |
| 39 | |
| 35 | |
| 19 | |
| 17 |
| User | Count |
|---|---|
| 73 | |
| 70 | |
| 37 | |
| 35 | |
| 26 |