Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
lepettit
Regular Visitor

PQ need help creating "does not contain" and not equal to argument

I'm trying to look across a couple of columns to determine if a condition is true then report out "Premix". I'm new to PQ and figuring out this type of syntax. Appreciate any assistance.

 

= if [Medication Name] Text.Contains "minibag" then "Premix" or if [Medication ERX ID] <> 27838 or [Medication ERX ID] <> 9364) then "Premix"

 

I also tried this initially and it did not work, possibly different arguments needed.

= if [Medication Name] does not contain "minibag" or if [Medication ERX ID] <> 27838 or [Medication ERX ID] then "Premix"

 

lepettit_0-1646903808146.png

 

2 ACCEPTED SOLUTIONS
BA_Pete
Super User
Super User

Hi @lepettit ,

 

Your syntax should be something like this:

if Text.Contains([Medication Name], "minibag") then "Premix"
else if not List.Contains({27838, 9364}, [Medication ERX ID]) then "Premix"
else //your escape clause, like null, "error" etc.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

Vijay_A_Verma
Super User
Super User

A slightly different way would be (you can replace null appropriately)

= if Text.Contains([Medication Name],"minibag") or not List.Contains({27838,9364},[Medication ERX ID]) then "Premix" else null

 

View solution in original post

3 REPLIES 3
lepettit
Regular Visitor

Thank you, this worked 🙂

Vijay_A_Verma
Super User
Super User

A slightly different way would be (you can replace null appropriately)

= if Text.Contains([Medication Name],"minibag") or not List.Contains({27838,9364},[Medication ERX ID]) then "Premix" else null

 

BA_Pete
Super User
Super User

Hi @lepettit ,

 

Your syntax should be something like this:

if Text.Contains([Medication Name], "minibag") then "Premix"
else if not List.Contains({27838, 9364}, [Medication ERX ID]) then "Premix"
else //your escape clause, like null, "error" etc.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors