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 there,
After much searching and attemps, I can't seem to get this to work. I'm trying to create a calculated field where if the Program Type column contains either "NAPIS" "Meals (AWD)" or "Meals AWD" AND the Received Unit(s) column is "No" then it is marked "Exclude", else "Include". I've tried to use "IN" but it doesn't like that. The problem with the below seems to be that there's a space in some of the terms, but I thought the point of parentheses is to show it's a text string and therefore can contain spaces. Thank you so much in advance!! I really have tried many different ways of acheiving the desired result, to no avail.
*Program Type = switch(true(),
Containsstring('CAGC Export FY 2021 - RF'[Program Type], "napis*")
|| Containsstring('CAGC Export FY 2021 - RF'[Program Type], “*Meals (AWD)”)
|| Containsstring('CAGC Export FY 2021 - RF'[Program Type], “*Meals AWD”)
AND Containsstring('CAGC Export FY 2021 - RF'[Received Unit(s)], “No”),
“Exclude”,
“Include”
Solved! Go to Solution.
Hi @RodFinetti
Try this code to add a new column to your table:
IN or Out =
SWITCH (
TRUE (),
CONTAINSSTRING ( 'CAGC Export FY 2021 - RF'[Program Type], "napis" )
&& CONTAINSSTRING ( 'CAGC Export FY 2021 - RF'[Received Unit(s)], "NO" ), "Exclude",
CONTAINSSTRING ( 'CAGC Export FY 2021 - RF'[Program Type], "Meals (AWD)" )
&& CONTAINSSTRING ( 'CAGC Export FY 2021 - RF'[Received Unit(s)], "NO" ), "Exclude",
CONTAINSSTRING ( 'CAGC Export FY 2021 - RF'[Program Type], "Meals AWD" )
&& CONTAINSSTRING ( 'CAGC Export FY 2021 - RF'[Received Unit(s)], "NO" ), "Exclude",
"Include"
)
Output:
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos🙏!!
Hi @RodFinetti
Try this code to add a new column to your table:
IN or Out =
SWITCH (
TRUE (),
CONTAINSSTRING ( 'CAGC Export FY 2021 - RF'[Program Type], "napis" )
&& CONTAINSSTRING ( 'CAGC Export FY 2021 - RF'[Received Unit(s)], "NO" ), "Exclude",
CONTAINSSTRING ( 'CAGC Export FY 2021 - RF'[Program Type], "Meals (AWD)" )
&& CONTAINSSTRING ( 'CAGC Export FY 2021 - RF'[Received Unit(s)], "NO" ), "Exclude",
CONTAINSSTRING ( 'CAGC Export FY 2021 - RF'[Program Type], "Meals AWD" )
&& CONTAINSSTRING ( 'CAGC Export FY 2021 - RF'[Received Unit(s)], "NO" ), "Exclude",
"Include"
)
Output:
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos🙏!!
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 |
---|---|
23 | |
10 | |
10 | |
9 | |
7 |