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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Rinat
Helper I
Helper I

power query text.contains multiple conditions

Hi all.

I'm trying to make new custom column based on values in u_regulatoryflag column. It contains IDs whihc I'm makin human readable text out of these. Here is a Sample code:

 

dv_u_regulatory_flag = Table.AddColumn(#"Filtered values", "dv_u_regulatory_flag", 
    
    each if Text.Contains([u_regulatoryflag], "29744385db18cc508a363a0f9d961950") then "Value1" 
    
    else if Text.Contains([u_regulatoryflag], "5384c385db18cc508a363a0f9d96198f") then "Value2" 

    else if Text.Contains([u_regulatoryflag], "29744385db18cc508a363a0f9d961950") and Text.Contains([u_regulatoryflag], "5384c385db18cc508a363a0f9d96198f") then "Value1, Value2"

    else null)

in
    dv_u_regulatory_flag

First two conditions always work. The third one with "and" doesn' work. However if I comment the first two conditions the third one starts working.

Can someone please explain this behaviour and help me to put together the query?

 

Thank you.

1 ACCEPTED SOLUTION
HotChilli
Community Champion
Community Champion

I think you need to check the more complex condition first

View solution in original post

2 REPLIES 2
Rinat
Helper I
Helper I

thanks @HotChilli it seems like it did a trick 😀

HotChilli
Community Champion
Community Champion

I think you need to check the more complex condition first

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

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

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.