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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
v-shex-msft
Community Support
Community Support

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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.