Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hello,
i built a few queries with power query and i want to pass the filenames as parameters.
often, the files start with the same string and end with dates or numbers.
i managed to have the filenames, but i'm stuck when i want to transform it in parameters.
For example the following steps :
let
Source = Folder.Files(Dossier_Données),
#"Colonne conditionnelle ajoutée" = Table.AddColumn(Source, "NomFichier", each if
Text.StartsWith([Name], "L083_-_Liste_absences_toutes_categories_par_salarié_sur_une_période") then [Name]
else null),
#"Colonnes permutées" = Table.ReorderColumns(#"Colonne conditionnelle ajoutée",{"Content", "Name", "Extension", "NomFichier", "Date accessed", "Date modified", "Date created", "Attributes", "Folder Path"}),
#"Lignes filtrées" = Table.SelectRows(#"Colonnes permutées", each ([NomFichier] <> null)),
#"Colonnes supprimées" = Table.RemoveColumns(#"Lignes filtrées",{"Content", "Name", "Extension", "Date accessed", "Date modified", "Date created", "Attributes", "Folder Path"}),
NomFichier = #"Colonnes supprimées"{0}[NomFichier]
in
NomFichier
is there a way to achieve this ?
thanks
Solved! Go to Solution.
let
fx=(p as text)=> let
Source = Folder.Files(Dossier_Données),
#"Colonne conditionnelle ajoutée" = Table.AddColumn(Source, "NomFichier", each if
Text.StartsWith([Name], p) then [Name]
else null),
#"Colonnes permutées" = Table.ReorderColumns(#"Colonne conditionnelle ajoutée",{"Content", "Name", "Extension", "NomFichier", "Date accessed", "Date modified", "Date created", "Attributes", "Folder Path"}),
#"Lignes filtrées" = Table.SelectRows(#"Colonnes permutées", each ([NomFichier] <> null)),
#"Colonnes supprimées" = Table.RemoveColumns(#"Lignes filtrées",{"Content", "Name", "Extension", "Date accessed", "Date modified", "Date created", "Attributes", "Folder Path"}),
NomFichier = #"Colonnes supprimées"{0}[NomFichier]
in
NomFichier
in
fx
let
fx=(p as text)=> let
Source = Folder.Files(Dossier_Données),
#"Colonne conditionnelle ajoutée" = Table.AddColumn(Source, "NomFichier", each if
Text.StartsWith([Name], p) then [Name]
else null),
#"Colonnes permutées" = Table.ReorderColumns(#"Colonne conditionnelle ajoutée",{"Content", "Name", "Extension", "NomFichier", "Date accessed", "Date modified", "Date created", "Attributes", "Folder Path"}),
#"Lignes filtrées" = Table.SelectRows(#"Colonnes permutées", each ([NomFichier] <> null)),
#"Colonnes supprimées" = Table.RemoveColumns(#"Lignes filtrées",{"Content", "Name", "Extension", "Date accessed", "Date modified", "Date created", "Attributes", "Folder Path"}),
NomFichier = #"Colonnes supprimées"{0}[NomFichier]
in
NomFichier
in
fx
Hello @smpa01
it works, thanks.
just a question, i had the "rebuild this data combination" error in all nested queries in my project, is it a normal behaviour of Power Query ?
I am sorry to hear that you are getting that error. Power query does generate that weird error. I also had that error at some point. I also refereed to the same URL as you did. But don't remeber if that solved my trouble.
Do you mind creating a seperate thread for that issue in particular with all the detailed code and snapshot of the query step which generates this bug.
I will try to solve that but if dor some reason I can't, someone else will for sure.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
17 | |
9 | |
8 | |
7 | |
7 |