Forum Discussion
[Power Query - M] Text.Contains
- 8 years ago
hi, rfaure
1. Import to TABLE 1
2. Import to TABLE2
3. Change the query in TABLE1
4. In QUERY EDITOR (the code below)let Fonte = Excel.Workbook(File.Contents("C:\Users\adm\Desktop\KUNDOO 345233\KUNDOO_345233.xlsx"), null, true), DATES_Sheet = Fonte{[Item="TABELA1",Kind="Sheet"]}[Data], #"Cabeçalhos Promovidos" = Table.PromoteHeaders(DATES_Sheet, [PromoteAllScalars=true]), #"Colunas Renomeadas" = Table.RenameColumns(#"Cabeçalhos Promovidos",{{"Column1", "Column0"}}), #"Personalização Adicionada" = Table.AddColumn(#"Colunas Renomeadas", "TABELAS", each TABELA2 ), #"TABELAS Expandido" = Table.ExpandTableColumn(#"Personalização Adicionada", "TABELAS", {"Column1", "Column2"}, {"Column1", "Column2"}), #"Personalização Adicionada1" = Table.AddColumn(#"TABELAS Expandido", "Personalizar", each if Text.PositionOf([Column0],[Column1])>=0 then "Ok!" else "Nk!"), #"Tipo Alterado" = Table.TransformColumnTypes(#"Personalização Adicionada1",{{"Column0", type text}, {"Column1", type text}, {"Column2", type text}, {"Personalizar", type text}}) in #"Tipo Alterado"Please try and test using it. And please mark the right reply as answer if your issue has been resolved, otherwise, please feel free to ask if you have any other issue.
Best Regards,
Rfranca
HI, eniX
sorry
Some alternatives to solve your problem:
1. Send the two columns of data as a sample to validate my solution.
or
2. I believe that if you just need the records that match your image, try deleting the [COLUMN1] column and filter the [CUSTOM] column with only the "Ok!".
You can find my data on xlsx in a zip with this link :
https://takeafile.com/?f=tuyegijesu
Thanks you
- Rfranca8 years agoResolver IV
hi, rfaure
Hi
Check if this is what you need?
One only question that remained is when an [Complémentaire] has two [Réseau] like you want to do with it.Please try and test using it. And please mark the right reply as answer if your issue has been resolved, otherwise, please feel free to ask if you have any other issue.
Best Regards,
Rfranca - rfaure8 years agoFrequent Visitor
I'm sorry, I did not really understand the manipulation. My adaptation was completely erratic. But your solution works properly. thank you very much
- Rfranca8 years agoResolver IV
hi, rfaure
To help you apply to your database, I'm sending the sample file.
https://takeafile.com/?f=gisafojiju
Please feel free to ask if you have any other issue.
Best Regards,
Rfranca - rfaure8 years agoFrequent Visitor
I now have a new problem to adapt the solution to the actual database. he returns the following error :
I think I know where this error comes from. Currently my database is created thanks to a multitude of CSV file (monthly extraction). This file is compiled together with a query function that I adapted.
Example :
I have the following directory consists of several csv file that I have to compile into one to form a single table.
Then using a query function I compile all the files.
RecupPatient :
let RecuperationPatient = (MonFichier) => let Source = Csv.Document(File.Contents(MonFichier),[Delimiter=";", Columns=35, Encoding=1252, QuoteStyle=QuoteStyle.None]), #"Premières lignes supprimées" = Table.Skip(Source,2), #"En-têtes promus" = Table.PromoteHeaders(#"Premières lignes supprimées", [PromoteAllScalars=true]) in #"En-têtes promus" in RecuperationPatient