+ Reply to Thread
Results 1 to 6 of 6

Adding Missing Dates To A .CSV File Via Power Query?..

  1. #1
    Forum Contributor
    Join Date
    02-09-2016
    Location
    West Midlands
    MS-Off Ver
    2016
    Posts
    224

    Adding Missing Dates To A .CSV File Via Power Query?..

    Hi Guys!

    I have imported a .CSV file with all the data i need.

    The Headers after importing into Power Query are;

    DATE / COURSE / TIME / NAME / RESULT

    Problem i have is that i am trying to run a weekly test on these Values. I Filter the data i need for the week but i just realised that some days are missing as no Data
    was recorded for that day.

    How do i Add the missing dates? It Needs to show the missing date but the other headers can all be blank or just have "N/A" as values.

    Any ideas if this can be achieved in Excel / Power Query?.. Or should i be looking at a .CSV Editor to add these missing dates?


    Thanks for looking guys, appreciate it!

  2. #2
    Forum Expert avk's Avatar
    Join Date
    07-12-2007
    Location
    India
    MS-Off Ver
    Microsoft Office 2013
    Posts
    3,223

    Re: Adding Missing Dates To A .CSV File Via Power Query?..

    Do you mean to find out missing date from date list. If correct then see attach file.
    Suppose date in From "A2"
    >In "F2"
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    >In "F3"
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    >iN "g1"
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    This is array formula ensure [SHIFT+CTRL+ENTER]
    Attached Files Attached Files


    atul


    If my answer (or that of other members) has helped you, please say "Thanks" by clicking the Add Reputation button at the foot of one of their posts.

    Also: if your problem is solved, please take the time to mark your thread as SOLVED by going to the top of your first post, selecting "Thread Tools" and then "Mark thread as solved".

  3. #3
    Registered User
    Join Date
    01-01-2013
    Location
    London, England
    MS-Off Ver
    Excel 2010, 2013, 2016
    Posts
    47

    Re: Adding Missing Dates To A .CSV File Via Power Query?..

    Hi Ourkid,

    I think the easiest way to do what you are asking is create 'date' table and import that via PQ, then append the queries together. There are ways to do it without the extra table - but without the data it would be hard to explain.

    Regards,

    James

  4. #4
    Forum Contributor
    Join Date
    02-09-2016
    Location
    West Midlands
    MS-Off Ver
    2016
    Posts
    224

    Re: Adding Missing Dates To A .CSV File Via Power Query?..

    Thanks Guys!

    Its to actually add them but thank you 'avk' im sure that code will come in useful, i'm actually testing that now.

    Yes James that's what i have done. I have created a fully .CSV file with ALL the date and im playing around with trying to merge them together.
    I cant understand the order or option though to add the extra dates to my main table?

    Any ideas?

  5. #5
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Adding Missing Dates To A .CSV File Via Power Query?..

    You can create a list of dates using a function:
    Please Login or Register  to view this content.
    You can then merge this list with your CSV data, using a left outer join, so it includes ALL dates and CSV data where those dates exist in your CSV file:
    Please Login or Register  to view this content.
    See attachment for worked example.
    Attached Files Attached Files
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  6. #6
    Forum Contributor
    Join Date
    02-09-2016
    Location
    West Midlands
    MS-Off Ver
    2016
    Posts
    224

    Re: Adding Missing Dates To A .CSV File Via Power Query?..

    Brilliant!

    Thank guys for your help and support... this has worked and i have taken all your variations and learnt alot!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. error in power query & power pivot
    By Baldev Kumar in forum Excel Charting & Pivots
    Replies: 8
    Last Post: 01-03-2018, 01:34 AM
  2. Power Query Duration Between Two Dates
    By mielkew27 in forum Excel General
    Replies: 3
    Last Post: 04-18-2017, 01:31 AM
  3. Power Query - Add dates to fixed Data set
    By happydays886 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-17-2017, 10:40 AM
  4. Adding data to the end of a table with Power Query
    By afila in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-14-2016, 08:29 AM
  5. Power Query how do i reuse on a new file
    By thorrrr in forum Excel General
    Replies: 3
    Last Post: 05-03-2014, 02:07 PM
  6. Adding rows for missing dates
    By JonesyCC in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-17-2013, 03:10 PM
  7. Adding rows of missing dates and times
    By h2005 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 10-11-2012, 07:21 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1