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

View all the Fabric Data Days sessions on demand. View schedule

Reply
tameemyousaf
Helper I
Helper I

Search in column with many to many relationship

Hi,

 

I have two table with name Actual & FlowTypeControl. I need to add a new column in Actual table based on text search (it will be trigger column from FlowTypeControl table) from comments column. 

 

Condition for new column will be like this:

 

IF Comments like FlowTypeControl.Trigger Then FlowTypeControl.FlowType ELSE Blank

 

Below are the screenshots of tables with sample data and required results.

 

tameemyousaf_0-1626292011972.png

 

tameemyousaf_1-1626292086719.png

 

tameemyousaf_2-1626292150220.png

 

Can anyone help?

 

 

 

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

The CONTAINSSTRING function is useful here.

 

ActualFlowType =
VAR CRK = Actual[CountryRegionKey]
VAR Comments = Actual[Comments]
RETURN
    MAXX (
        FILTER (
            FlowTypeControl,
            FlowTypeControl[CountryRegionKey] = CRK
                && CONTAINSSTRING ( Comments, FlowTypeControl[Trigger] )
        ),
        FlowTypeControl[FlowType]
    )

 

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi @tameemyousaf,

Did AlexisOlson 's suggestions help with your scenario? if that is the case, you can consider Kudo or accept the helpful suggestions to help others who faced similar requirements to find it more quickly.

If these also not help, please share more detailed information to help us clarify your scenario to test.

How to Get Your Question Answered Quickly 

Regards,

Xiaoxin Sheng

AlexisOlson
Super User
Super User

The CONTAINSSTRING function is useful here.

 

ActualFlowType =
VAR CRK = Actual[CountryRegionKey]
VAR Comments = Actual[Comments]
RETURN
    MAXX (
        FILTER (
            FlowTypeControl,
            FlowTypeControl[CountryRegionKey] = CRK
                && CONTAINSSTRING ( Comments, FlowTypeControl[Trigger] )
        ),
        FlowTypeControl[FlowType]
    )

 

Thanks @AlexisOlson

 

One more question, is there any way if we give just one region in FlowTypeControl table and set country blank and it will give data of all countries in that region. For example, if i give just North America and blank country then it should show the data for all the countries in North America. All countries of North America will be present in Actual table

I'm not sure where you "set country" or where "it will give data". Are you talking about slicer and visuals or measure variables and calculated tables or what?

@AlexisOlson I am not talking about any measure or table. I am talking about the data. When we add data in flowTypeControl table like this. Then how can we handle the situation of all countries.

 

tameemyousaf_0-1626462978426.png

 

 

 

How about matching on Region and Country separately rather than using the combined key and replacing blank with All?

 

ActualFlowType =
VAR Region = Actual[Region]
VAR Country = IF ( ISBLANK ( Actual[Country] ), "All", Actual[Country] )
VAR Comments = Actual[Comments]
RETURN
    MAXX (
        FILTER (
            FlowTypeControl,
            FlowTypeControl[Region] = Region
                && FlowTypeControl[Country] = Country
                && CONTAINSSTRING ( Comments, FlowTypeControl[Trigger] )
        ),
        FlowTypeControl[FlowType]
    )

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors