Load Files from Folder – Update not Working

  • Load Files from Folder – Update not Working

    Posted by DSC Communities on April 10, 2020 at 5:06 pm
    • Mark Wolven

      Member

      April 10, 2020 at 5:06 PM

      So, a few months ago I was asked to build some reports and the source of the data was going to be monthly Excel worksheets. A sheet is generated for each month and dropped in a folder organized by topic. So far, so good.

      I used the Get Data|New Source|Folder option. Set the path, chose the 4 files that were there. Imported them and good to go.

      Fast forward to now. There are 2 new additional files in the folder. Fine. Go to transform data, check the source, refresh the preview, the new files are on the list, and the new rows show in the preview table. Great.

      I hit Close and Apply and it closes way too quick. The new rows aren’t visible in the table and the data is not up to date.

      What am I missing? Is there a step I’ve forgotten?

      ——————————
      Mark Wolven
      Lead Informatics Consultant
      Mark Wolven
      8602733171
      ——————————

    • Ben Howard

      Member

      April 13, 2020 at 7:36 AM

      Hi Mark, no magic answers but a couple of thoughts

      1.Ā  You say you choose the 4 files to load, you shouldn’t need to do this, you just do the folder.Ā  Was this a typo or am I missing something?
      2.Ā  Any errors in the load.Ā  When you initially created the query from Power BI there is a checkbox that says “Ignore files with errors” – do you remember if this was checked.
      3.Ā  Any filters on the report which wouldn’t display the data?

      ——————————
      Ben Howard
      ——————————
      ——————————————-

    • John Thomas

      Member

      April 13, 2020 at 12:41 PM

      Hi Mark.Ā 

      Sounds like instead of loading the files from the folder, it’s loading just one file.Ā  (?) – This would generate the results you are describing.Ā  New files are not loading, no errors, etc.Ā  We do a lot of this type of loading as well.Ā  I have found the following pattern helpful:
      1. Create a function (or Parameter) that holds the path to your folders.Ā  This way if something changes, it’s easy to modify in one place.
      2. Perform the ETL functions needed on ONE file, then turn that query into a function.
      3. When you load the files from folder, add a column From Function and use the function you created in step #2.

      This should straighten things out.

      If you are using Excel, here’s a function, fxGetParmater? that I use all the time.Ā  If you are using Power BI, you can create a Parameters table and modify the code to pull data from the table in Power BI rather than the Excel Workbook table.

      (ParameterName as text) =>
       let
           ParamSource = dimParameter,
      //    ParamSource = Excel.CurrentWorkbook(){[Name="Parameter"]}[Content],
           ParamRow = Table.SelectRows(ParamSource, each ([Parameter]=ParameterName)),
           Value =
      	if Table.IsEmpty(ParamRow)=true
      	then null
      	else Record.Field(ParamRow{0},"Value")
      in
          Value

      The Table in Excel should have the following columns:

      Parameter,Ā  Ā  Ā  Value,Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Comments
      Folder.LocĀ  Ā  Ā  C:MyDataExportsĀ  Ā Folder Path to data

      Name the Table “Parameters”.Ā  You will need to remark out the dimParameter source in the above code and unremark the Excel.Workbook part of the code to switch.Ā  If you are making a Power BI Table, it should have the same columns.

      Modify your Source step to the following:
      Source = Folder.Files(fxGetParameter(“Folder.Loc”))

      Hope this helps.Ā  If you need more specific help, upload a sample file so we can look at it…

      Cheers!

      ——————————
      John Thomas
      Director of Project Controls and Estimating
      Huntersville NC
      980-287-2614
      ——————————
      ——————————————-

    DSC Communities replied 5 years, 11 months ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

The discussion ‘Load Files from Folder – Update not Working’ is closed to new replies.

Start of Discussion
0 of 0 replies June 2018
Now

Welcome to our new site!

Here you will find a wealth of information created for peopleĀ  that are on a mission to redefine business models with cloud techinologies, AI, automation, low code / no code applications, data, security & more to compete in the Acceleration Economy!