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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Centaur
Helper IV
Helper IV

Get File Name

Hello, I am using PQ and I am having difficulty in appending the source file name as a column.  

I have pasted my code below. 

How could the below code be modified to show the source file name?  

the file name is FBL1N Consolidated PQ.xlsx

 

Gratefule for the help,

thank you

 

 

Advanced Editor:

let
Source = Excel.Workbook(File.Contents("C:\Users\ME\Box\Financing\Project Finance\DRAWS\Liquidity Reserve\FBL1N Consolidated PQ.xlsx"), null, true),
#"FBL1N Pmts_Sheet" = Source{[Item="FBL1N Pmts",Kind="Sheet"]}[Data],
#"Promoted Headers" = Table.PromoteHeaders(#"FBL1N Pmts_Sheet", [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"JumpTo", type any}, {"Column2", type any}, {"Proposal Date", type date}, {"Company Code", type text}, {"Name", type text}, {"Reference", type text}, {"Amount in doc. curr.", type number}, {"Document Number", Int64.Type}, {"Pay Yes/No", type text}, {"Document Date", type date}, {"Posting Date", type date}, {"Net due date", type date}, {"Invoice No Stripped", type text}, {"Payment Method", type text}, {"Column16", type text}, {"Vendor", Int64.Type}, {"Payee/er", Int64.Type}, {"Clearing Document", Int64.Type}, {"Clearing date", Int64.Type}, {"Text", type text}, {"Part.bank type", type text}, {"Payment Block", type text}, {"Terms of Payment", type text}, {"Sheet1", type text}})
in
#"Changed Type"

1 ACCEPTED SOLUTION
PhilipTreacy
Super User
Super User

Hi @Centaur 

 

Is this a one off request for this particular query, or soemthing you need to do with other queries?

 

If it's just this query, you already know the filename as it's hard coded into your query.  So just add the filename as needed.

 

That said, you've asked how to append the filename as a column.  Appending is when you already have a column/table and you are adding more rows to those columns.  So I'm not sure you mean append?

 

Would be easier if you showed exactly what it is you want as a result.

 

If you want to add a column with the filename then add a Custom Column and just use this code

 

= "FBL1N Consolidated PQ.xlsx"

 

If I haven't answered the problem please supply more info an an exampe fo the desired result/table.

 

Phil

 



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

2 REPLIES 2
PhilipTreacy
Super User
Super User

Hi @Centaur 

 

Is this a one off request for this particular query, or soemthing you need to do with other queries?

 

If it's just this query, you already know the filename as it's hard coded into your query.  So just add the filename as needed.

 

That said, you've asked how to append the filename as a column.  Appending is when you already have a column/table and you are adding more rows to those columns.  So I'm not sure you mean append?

 

Would be easier if you showed exactly what it is you want as a result.

 

If you want to add a column with the filename then add a Custom Column and just use this code

 

= "FBL1N Consolidated PQ.xlsx"

 

If I haven't answered the problem please supply more info an an exampe fo the desired result/table.

 

Phil

 



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Hi Philip, thank you for the response. I didn't think of that.  That sounds pretty easy. I think it might work but will circle back to let you know if I need something more robust.  Not a computer at the moment.  Thank you!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors