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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Anonymous
Not applicable

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

1 ACCEPTED SOLUTION
v-angzheng-msft
Community Support
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:

v-angzheng-msft_0-1617343376420.png

Result:

v-angzheng-msft_1-1617343376425.png

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 Zheng

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

View solution in original post

4 REPLIES 4
v-angzheng-msft
Community Support
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:

v-angzheng-msft_0-1617343376420.png

Result:

v-angzheng-msft_1-1617343376425.png

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 Zheng

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

tex628
Community Champion
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


Connect on LinkedIn
Anonymous
Not 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 

 
 

Unbenannt.PNG

 

 

 

 

 

tex628
Community Champion
Community Champion

Dont create a measure, create a calculated column in the table. 

/ J


Connect on LinkedIn

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.