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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Contains with more than one value

Hi,

 

Im trying to create a measure to replace specific values in a visual table with N/A where not applicable.

 

I can get the code to work for one row (351), but I dont know how to put multiple values in the contains?

 

Could somebody please help?

 

My code is below.

 

Test = IF (
          CONTAINS(vwtest,vwtest[Key],351),"N/A"
         ,CALCULATE(
         SUMX('vwtest', [Count]), 'vwtest'[Breached] = "Y") + 0 )
 
Thanks
 
Liam
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Try this 

Test = IF (
         max(vwtest[Key]) in {351,352,353},"N/A"
         ,CALCULATE(
         SUMX('vwtest', [Count]), 'vwtest'[Breached] = "Y") + 0 )
 
I don't know why are you adding 0 at the end.
 
Thanks & regards,
Pravin Wattamwar
www.linkedin.com/in/pravin-p-wattamwar

If I resolve your problem Mark it as a solution and give kudos.
 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Try this 

Test = IF (
         max(vwtest[Key]) in {351,352,353},"N/A"
         ,CALCULATE(
         SUMX('vwtest', [Count]), 'vwtest'[Breached] = "Y") + 0 )
 
I don't know why are you adding 0 at the end.
 
Thanks & regards,
Pravin Wattamwar
www.linkedin.com/in/pravin-p-wattamwar

If I resolve your problem Mark it as a solution and give kudos.
 
Anonymous
Not applicable

Thanks @Anonymous 

 

That worked perfectly. The + 0 fills in my blanks with zeros,

Pragati11
Super User
Super User

Hi @Anonymous ,

 

You can use something like this as follows:

                                                                     CONTAINS(InternetSales, [ProductKey], 214, [CustomerKey], 11185)

 

Refer following link:

https://docs.microsoft.com/en-us/dax/contains-function-dax

 

If this helps please give Kudos and mark it as a Solution! 🙂

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.