Forum Discussion
If contains then yes
Hi all,
I have a visual (table) with columns from different linked data tables in the background in my PBI file. Now I want to create a DAX that would be like this:
Look in the "Warehouse"[List] column for the text part from the "Warehouse"[Place] column.
If "Warehouse"[Place] is in "Warehouse"[List], then show in a new column "yes".
For example:
Warehouse_List contains (AX,AM,AF)
Warehouse_Place (AX)
Result: yes
I hope you can help me with the "if contains then" measure.
Have already tried a few things, but I can not find the tables (Warehouse[List]) and (Warehouse[Place]) in the If-Contains formula.
Thank you
Mary
Hi Anonymous
You can try to create a calculate column using CONTAINSSTRINGEXACT or FIND function
If contains then yes (CONTAINSSTRINGEXACT) = IF ( CONTAINSSTRINGEXACT ( 'Table'[Aisle_list], 'Table'[Aisle] ), "Yes", "No" )Or
If contains then yes (Find) = IF ( ISBLANK ( FIND ( 'Table'[Aisle], 'Table'[Aisle_list], 1, BLANK () ) ), "No", "Yes" )Sample data:
Result:
Is this the result you want? Hope this is useful to you
Please feel free to let me know if I misunderstand your question
Best Regards,
Community Support Team _ Zeon ZhengIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
4 Replies
- tex628
Community Champion
Hi Anonymous ,
Try creating a calculated column in the Warehouse table using the CONTAINSSTRING(<within_text>, <find_text>) syntax.
Something like this:
Column = IF( CONTAINSTRING ( Warehouse[Place] , Warehouse[List] ) , "Yes" , "No" )
Hope this helps,
Br,
J- AnonymousNot applicable
Hi J
don´t work. Get an error.
Please see my screenshot. If Aisle information is in Aisle_list then yes, if not no.
CK is in CD,CE...CJ,CK... = yes
CK is in FB = no
With Containsstring i can not find the columne in the measure.
BR
Mary
- tex628
Community Champion
Dont create a measure, create a calculated column in the table.
/ J
- v-angzheng-msft
Community Support
Hi Anonymous
You can try to create a calculate column using CONTAINSSTRINGEXACT or FIND function
If contains then yes (CONTAINSSTRINGEXACT) = IF ( CONTAINSSTRINGEXACT ( 'Table'[Aisle_list], 'Table'[Aisle] ), "Yes", "No" )Or
If contains then yes (Find) = IF ( ISBLANK ( FIND ( 'Table'[Aisle], 'Table'[Aisle_list], 1, BLANK () ) ), "No", "Yes" )Sample data:
Result:
Is this the result you want? Hope this is useful to you
Please feel free to let me know if I misunderstand your question
Best Regards,
Community Support Team _ Zeon ZhengIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.