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
alvinyurisman
New Member

How to use DAX filter using IN with String Parameter?

Hello everyone

I want to add a custom column to a table B with some calculation to get the maximum value on a product in another table A, however, each event_venue_id in table B might have a different product assignment.

This is source table A for the calculation (I created a column named productid_string with the Text data type):

pbi3.PNG

I have prepared the list of product maps for each event_venue_id, adding the productidlist column in table B as follows:

pbi4.PNG

the result in table B (column productidlist)

pbi2.PNG

Then I create the custom column in table B (ITR M-3) to get the maximum product value like this.

When I got the values in a variable and use it inside the filter that doesn't work using double quotes, then I tried to test manually using unichar(34) and it works.

pbi.PNG

Can someone help me correct the parameter or how to filter using multiple product ID values?

Thank you

3 REPLIES 3
v-yingjl
Community Support
Community Support

Hi @alvinyurisman ,

 

If you've fixed the issue on your own please kindly share your solution. If the above posts help, please kindly mark it as a solution to help others find it more quickly. Thanks!


Best Regards,
Yingjie Li

v-yingjl
Community Support
Community Support

Hi @alvinyurisman ,

Based on your discription, if you write like IN {"94"}, it represents only 94 not a string parameter "94" so that when you write like IN {UNICHAR(34) & 94 & UNICHAR(34) }, it will represent a string parameter "94".

You can try to use CONTAINSSTRING() function instead of IN() function, please refer:

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

 

Best Regards,
Yingjie Li

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

Greg_Deckler
Super User
Super User

See the other version of this post:
https://community.powerbi.com/t5/Desktop/How-to-use-DAX-Filter-using-IN-with-String-Parameter/m-p/10...

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.