Forum Discussion
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):
I have prepared the list of product maps for each event_venue_id, adding the productidlist column in table B as follows:
the result in table B (column productidlist)
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.
Can someone help me correct the parameter or how to filter using multiple product ID values?
Thank you
3 Replies
- Greg_DecklerCommunity ChampionSee the other version of this post:
https://community.powerbi.com/t5/Desktop/How-to-use-DAX-Filter-using-IN-with-String-Parameter/m-p/1062278/highlight/false#M496104 - v-yingjlCommunity Support
Hi Anonymous ,
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 LiIf this post helps then please consider Accept it as the solution to help the other members find it more quickly.
- v-yingjlCommunity Support
Hi Anonymous ,
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