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
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
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