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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
baruojha
New Member

Error when using && Containsstring

Want a conditional colum when text in one column is "Others" and another column constans text strings , if both conditions are met the value in new column has to be "API" else "Others", however not successful to write correct statement and getting different errors: Can somebody guide where i am going wrong.

 

Revised Nature = SWITCH(TRUE(),

'Export (3)'[Nature Description]="Others"&& format(CONTAINSSTRING('Export (3)'[Name of the Product] , {"working Standard*","w.std*","wstd"}) ,"True/False")="True","API",


"Others")

 Error : A table to multiple values was supplied where a single value was expected.

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

Hi @baruojha ,

You can't use the symbol {} to represent a list in DAX, and CONTAINSSTRING function already returns true or false, don't need to format it .

Here's my solution, create a calculated column.

evised Nature =
SWITCH (
    TRUE (),
    'Export (3)'[Nature Description] = "Others"
        && (
            CONTAINSSTRING ( 'Export (3)'[Name of the Product], "working Standard*" )
                || CONTAINSSTRING ( 'Export (3)'[Name of the Product], "w.std*" )
                || CONTAINSSTRING ( 'Export (3)'[Name of the Product], "wstd" )
        ), "API",
    "Others"
)

Get the correct result.

vkalyjmsft_0-1666258527162.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

2 REPLIES 2
v-yanjiang-msft
Community Support
Community Support

Hi @baruojha ,

You can't use the symbol {} to represent a list in DAX, and CONTAINSSTRING function already returns true or false, don't need to format it .

Here's my solution, create a calculated column.

evised Nature =
SWITCH (
    TRUE (),
    'Export (3)'[Nature Description] = "Others"
        && (
            CONTAINSSTRING ( 'Export (3)'[Name of the Product], "working Standard*" )
                || CONTAINSSTRING ( 'Export (3)'[Name of the Product], "w.std*" )
                || CONTAINSSTRING ( 'Export (3)'[Name of the Product], "wstd" )
        ), "API",
    "Others"
)

Get the correct result.

vkalyjmsft_0-1666258527162.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.

lukiz84
Memorable Member
Memorable Member

The error is because you pass a table ( {"working Standard*, ...} ) to containsstring, that's not possible.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

FabCon and SQLCon Highlights Carousel

FabCon & SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.