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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
GeekAlfPro
Helper V
Helper V

File name startwith as parameter

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

1 ACCEPTED SOLUTION
smpa01
Community Champion
Community Champion

	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

========================
Did I answer your question? Mark my post as a solution!
Proud to be a Super User
My Custom Visualization Projects
• Plotting Live Sound: Live Sound
• Beautiful News: Women in Parliament, Energy Mix, Shrinking Armies
• Visual Capitalist: Working Hrs
• Others: Easing Graph, Animated Calendar
MayViz Submissions
• Week 1: View
• Week 2: View
• Week 3: View
• Week 4: View
========================

View solution in original post

3 REPLIES 3
smpa01
Community Champion
Community Champion

	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

========================
Did I answer your question? Mark my post as a solution!
Proud to be a Super User
My Custom Visualization Projects
• Plotting Live Sound: Live Sound
• Beautiful News: Women in Parliament, Energy Mix, Shrinking Armies
• Visual Capitalist: Working Hrs
• Others: Easing Graph, Animated Calendar
MayViz Submissions
• Week 1: View
• Week 2: View
• Week 3: View
• Week 4: View
========================

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 found a workaround here

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.


========================
Did I answer your question? Mark my post as a solution!
Proud to be a Super User
My Custom Visualization Projects
• Plotting Live Sound: Live Sound
• Beautiful News: Women in Parliament, Energy Mix, Shrinking Armies
• Visual Capitalist: Working Hrs
• Others: Easing Graph, Animated Calendar
MayViz Submissions
• Week 1: View
• Week 2: View
• Week 3: View
• Week 4: View
========================

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

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

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors