Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi Team,
I am trying to add a custom column based on two columns. I want the new column to tell me all rows where the Subject contains "trade" and "fail" but Contacts does not contain no-reply@123.com.
if (Text.Contains([Subject],"trade"))
and (Text.Contains([Contacts],"no-reply@123.com"))
and (Text.Contains([Subject],"fail"))
and not Text.Contains([Subject],"scheduled")
then "Trade Failure"
else ""
But the output is blank. When i run the code without the and not line, its working (but obviously not pulling what i want).
Solved! Go to Solution.
I just tried this and it worked .
if (Text.Contains([Subject],"trade"))
and (Text.Contains([Subject],"fail"))
and (
(Text.Contains([Contacts],"noreply@123.com"))
or
(Text.Contains([Contacts],"no-reply@123.com"))
)
and not (Text.Contains([Subject],"scheduled"))
and not (Text.Contains([Subject],"re:"))
then "Trade-In Failure"
else if (Text.Contains([Subject],"scheduled"))
and (Text.Contains([Subject],"fail"))
and (
(Text.Contains([Contacts],"noreply@123.com"))
or
(Text.Contains([Contacts],"no-reply@123.com"))
)
and not (Text.Contains([Subject],"trade"))
and not (Text.Contains([Subject],"re:"))
then "Report Failure"
else ""
What if you try:
IF (Text.Contains([Subject],"scheduled"), "",
if (Text.Contains([Subject],"trade")) and (Text.Contains([Contacts],"no-reply@123.com")) and (Text.Contains([Subject],"fail"))
)
Well there is another IF that i was wanting to nest into it so this wont work.
This is the currently the code with the nested if, but it doesn't work.
if (Text.Contains([Subject],"scheduled"))
and (Text.Contains([Contacts],"no-reply@123.com"))
then "Report Failure"
else if (Text.Contains([Subject],"trade"))
and (Text.Contains([Subject],"fail"))
and (Text.Contains([Contacts],"no-reply@123.com"))
then "Trade Failure"
I just tried this and it worked .
if (Text.Contains([Subject],"trade"))
and (Text.Contains([Subject],"fail"))
and (
(Text.Contains([Contacts],"noreply@123.com"))
or
(Text.Contains([Contacts],"no-reply@123.com"))
)
and not (Text.Contains([Subject],"scheduled"))
and not (Text.Contains([Subject],"re:"))
then "Trade-In Failure"
else if (Text.Contains([Subject],"scheduled"))
and (Text.Contains([Subject],"fail"))
and (
(Text.Contains([Contacts],"noreply@123.com"))
or
(Text.Contains([Contacts],"no-reply@123.com"))
)
and not (Text.Contains([Subject],"trade"))
and not (Text.Contains([Subject],"re:"))
then "Report Failure"
else ""
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
72 | |
70 | |
55 | |
38 | |
31 |
User | Count |
---|---|
71 | |
64 | |
64 | |
49 | |
45 |