Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Date data showing as "null" despite source data having values

Hi Guys   I have a strange one and im a bit of a power query newbie.    I am wanting to import 6 monthly excel files from a file using the "from file" function. They all have the same format and ...
  • BA_Pete's avatar
    3 years ago

    Hi Anonymous ,

     

    In your first screenshot, the column that has the null dates in it is called [APRIL PRODUCTS] and shows April dates. I doubt that the appropriate column in the February file is called [APRIL PRODUCTS] so Power BI can't append these two columns together. I suspect that further along in your table there will be a column called [FEBRUARY PRODUCTS] that only contains Feb dates and no Apr dates.

    In your second screenshot, contrary to the above, it appears as though the column in both tables was named [Delivery Date], so Power BI would be able to append these fine.

     

    When you import, I would recommend the following steps:

    -1- Use the Folder Connector on the folder where all your monthly reports get saved and select Combine & Transform.

    -2- Filter the top-level folder table in your final append query, probably on [Date created], to get the latest six dates, or however you need to filter to dynamically get the appropriate files to be appended.

    -3- In your Transform Sample File query that gets automatically generated, ensure that you change any file-specific column names to generic column names. You may need to be a bit clever with this as you don't want to hardcode the specific column name that you're changing from (as this won't work on other files with other column names) but if you search for "Dynamically change column names", you'll find a number of simple ways to do this.

     

    Once you've created generic column names in your sample file, Power BI will apply these transformations to all of the files you've filtered in step -2-, and will append them as required.

     

    Pete

     

  • BA_Pete's avatar
    BA_Pete
    3 years ago

     

    No, it doesn't affect the response. Sorry, I misspoke really when I said Power BI, everything in my answer relates entirely to Power Query.

     

    So the transformation you're talking about, this would be done within the Transform Sample File query to ensure it is applied to all imported files. You may need to click up the APPLIED STEPS list a bit to see at which step PQ assigns the top row to a column header, but it should be fairly easy to identify and add a step before it that deletes the top row.

     

    Pete