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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
WheelchairWilly
Helper II
Helper II

What is going wrong with this "CONTAINS" formula?

I need to know what team members in the Bavarian Team picked the correct goal "Scorers" in the goal scorers data. I can spent ages trying to correct the "CONTAINS" formula (The Red Lines etc) I thing that the Relationship between "Picked" and "Scorers" is fine, so why does "Contains" not work?Screenshot 2023-08-09 141207.pngScreenshot 2023-08-09 141308.png

1 ACCEPTED SOLUTION
v-yanjiang-msft
Community Support
Community Support

Hi @WheelchairWilly ,

According to your description, here's my solution. 

Create a calculated column in Bavarian table:

Column =
IF (
    CONTAINS ( 'Premiership', Premiership[Goal Scorers], 'Bavarian'[Picked] ),
    "Y"
)

Or this one:

Column1 =
IF (
    'Bavarian'[Picked]
        IN SELECTCOLUMNS ( 'Premiership', "Scorers", 'Premiership'[Goal Scorers] ),
    "Y"
)

All get the correct result:

vyanjiangmsft_0-1691738221226.png

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ kalyj

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

3 REPLIES 3
v-yanjiang-msft
Community Support
Community Support

Hi @WheelchairWilly ,

According to your description, here's my solution. 

Create a calculated column in Bavarian table:

Column =
IF (
    CONTAINS ( 'Premiership', Premiership[Goal Scorers], 'Bavarian'[Picked] ),
    "Y"
)

Or this one:

Column1 =
IF (
    'Bavarian'[Picked]
        IN SELECTCOLUMNS ( 'Premiership', "Scorers", 'Premiership'[Goal Scorers] ),
    "Y"
)

All get the correct result:

vyanjiangmsft_0-1691738221226.png

I attach my sample below for your reference.

 

Best Regards,
Community Support Team _ kalyj

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

WheelchairWilly
Helper II
Helper II

Hi there and thanks for your help with this matter. I tried your suggestion, unfortunally that disn't workeither. If it all right with you can I pass on the two files I'm trying to get right.

https://we.tl/t-0yiuwzJy9O

mlsx4
Memorable Member
Memorable Member

Hi @WheelchairWilly 

 

I think you are missing some values. Take a look at the structure: 

 

CONTAINS(<table>, <columnName>, <value>[, <columnName>, <value>]…)

 

You need also the second and third part of the IF statement

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.