Forum Discussion
campelliann
3 years agoPost Patron
How would you approach this? Text.Contains problem
Hi, I have to categorize projects based on one word. If the project Name contains "Formation" (as in training), I consider the project as a training type. The problem is that if I use Text.Contain...
- 3 years ago
Hi, campelliann ;
You could create a custom column as follow:
=if Text.Contains( Text.Upper([Project]),"INFORMAÇÃO") then "Not" else if Text.Contains( Text.Upper([Project]),"FORMAÇÃO") then "Traing" else "Null"The final show:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wcssvyk08vPzw4nyFzDyF/NKS4sriktTcYqVYnWilNBTJrMSyRLCwe2pxCUgsJVHBMw+hRj8TiaMUGwsA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Project = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Project", type text}}), #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom.1", each if Text.Contains( Text.Upper([Project]),"INFORMAÇÃO") then "Not" else if Text.Contains( Text.Upper([Project]),"FORMAÇÃO") then "Traing" else "Null") in #"Added Custom"
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
serpiva64
3 years agoSolution Sage
Hi,
use Text.StartWith instead of Text.Contain
- campelliann3 years agoPost Patron
Hi and thank you for your input. The issue is that the word often comes in the middle of the text...