Forum Discussion

mikesdunbar's avatar
mikesdunbar
Helper I
1 year ago
Solved

Custom column with source file name

I'm trying to make a column that lists  the source file name. In this case, I've imported an Excel file named FileName.xlsx. I don't know if there's someway I can just write some Power Query formula that will return a column with each line saying FileName. I've read dozens of messages about creating folder sources, Merging from SharePoint, that sort of thing. 

I feel like there's got to be a simple way to do it.

 

The reason I ask is that I'm putting together a monthly financial report, and the Excel file's name has the month and year in it. So, when someone opens it, I could make a card which lists that file name.

 

Thank you! 

  • For your reference.

     

    Step 0: I use these datafiles below.

               These files are in the 'DATAFOLDER' folder.

    202410_DATAFILE.xlsx

    202411_DATAFILE.xlsx

     

    Step 1: I click 'Get data' icon and select 'Folder' and click 'Connect' button  on Power BI Desktop.

     

    Step 2: I click 'Browse...' Button and select 'DATAFOLDER' folder and click 'OK' button.

     

    Step 3: I select 'Combine & Transform Data' menu.

     

    Step 4: I select 'Sheet1' and click 'OK' button.

     

    Step 5: I can get 'Source.Name' column automatically.

     

2 Replies

  • For your reference.

     

    Step 0: I use these datafiles below.

               These files are in the 'DATAFOLDER' folder.

    202410_DATAFILE.xlsx

    202411_DATAFILE.xlsx

     

    Step 1: I click 'Get data' icon and select 'Folder' and click 'Connect' button  on Power BI Desktop.

     

    Step 2: I click 'Browse...' Button and select 'DATAFOLDER' folder and click 'OK' button.

     

    Step 3: I select 'Combine & Transform Data' menu.

     

    Step 4: I select 'Sheet1' and click 'OK' button.

     

    Step 5: I can get 'Source.Name' column automatically.

     

  • Use the Folder (or SharePoint Folder)  connector. Then you get the filename column for free.