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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
HenryJS
Post Prodigy
Post Prodigy

If Column Contains three 'strings'

Hi all,

 

Is it possible to create a new column which states IF [Disciplines] =< 3 'Strings' THEN Yes

 

A string being anything with a , between it.

 

So Works Manager is one string

 

Technician is one string etc..

 

 

Capture.JPG

1 ACCEPTED SOLUTION
V-lianl-msft
Community Support
Community Support

Hi @HenryJS ,

 

You can also try using DAX to create a calculated column.

Column = IF(SEARCH( "*,*,*", 'Table'[Disciplines], 1, 0 ) > 0,BLANK(),"Yes")

test_search.PNG

 

Best Regards,
Liang
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

6 REPLIES 6
V-lianl-msft
Community Support
Community Support

Hi @HenryJS ,

 

You can also try using DAX to create a calculated column.

Column = IF(SEARCH( "*,*,*", 'Table'[Disciplines], 1, 0 ) > 0,BLANK(),"Yes")

test_search.PNG

 

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

parry2k
Super User
Super User

@HenryJS what defines the string, space between words or what? you gave the example what is one string but what 3 string, please provide the logic.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Hi @parry2k 

 

In this instance anything which has , besides it.

 

So we could do a statement which states if there are more than 2 "," THEN No

 

Does that make sense?

 

So if the field has more than 2 "," anywhere in the text THEN NO ELSE YES

@HenryJS I would recommend adding a custom column in power query to get the count and then you can derive your logic from there

 

here is a quick M code which you can paste in blank query and check it out and later add in to your query.

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSkxK1oFipVidaKWKyiowjSyWmJiog4TBYsnJyTpArBQbCwA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "String Count", each List.Count( Text.Split([Column1],",")), Int64.Type)
in
    #"Added Custom"

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k where abouts do I put this code?

 

And on the condition column how do I input the ,Capture.JPG

@HenryJS start a blank query and click advanced editor and paste it there.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.