+ Reply to Thread
Results 1 to 4 of 4

Power Query - Remove duplicates but retain data that may only appear once

  1. #1
    Valued Forum Contributor Harribone's Avatar
    Join Date
    02-24-2013
    Location
    Midlands, UK
    MS-Off Ver
    Excel 2019/365
    Posts
    570

    Power Query - Remove duplicates but retain data that may only appear once

    Hi,

    I am several years behind the times and I have jumped into the world of power query, so far I've found it to be a relatively straight forward tool to use (except my dodgy attempts to modify the code or source data which breaks it).
    Anyways I have a situation I can't seem to find a solution too so I'm handing it over to the professionals. That means you lot!

    So the data I am loading into PQ has duplicate entries and I want to remove them which is easy enough. The problem is that some fields/columns of data contain a value only once within the duplicates - I need to populate the null values before I remove duplicates so I don't lose any information during the ETL process.

    Attached is a crude example with mock data to show the stages I want to create. I know that I can sort the ID ascending then the date descending an finally fill the date down but with the example attached ID 'C' doesn't have a value and would be populated with the date from ID 'B'. 'C' somehow needs to remain blank/null.

    Hopefully the above makes sense, please let me know if you require clarification on anything.

    Thanks
    Harribone
    Attached Files Attached Files
    Say thanks, click *

  2. #2
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,222

    Re: Power Query - Remove duplicates but retain data that may only appear once

    Please try

    Sort ID ascending, Sort Date descending, Filled up

    Please Login or Register  to view this content.
    Attached Files Attached Files

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,445

    Re: Power Query - Remove duplicates but retain data that may only appear once

    Hi Harribone,

    No PQ needed in this PT answer. See the attached..

    PT no PQ Example Harribone.xlsx
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  4. #4
    Valued Forum Contributor Harribone's Avatar
    Join Date
    02-24-2013
    Location
    Midlands, UK
    MS-Off Ver
    Excel 2019/365
    Posts
    570

    Re: Power Query - Remove duplicates but retain data that may only appear once

    Sorry for delay. Work and illness changed my priorities.

    Thanks both for feedback
    Bo_Ry - The method you suggested works for the example however when there are more entries to handle this won't work (the blank ones will be anywhere within the data and fill up or down will just use the data for another item).
    MarvinP - Was hoping to avoid doing within excel just to reduce the steps etc. and keep things nice and tidy however a pivot table never came to mind! Should've seen this from day one!

    Mucho thanks
    Harribone

+ 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. [SOLVED] Code to Remove Duplicates from Rows but Retain Latest Record
    By hammer2 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-05-2020, 11:17 AM
  2. [SOLVED] Use VBA to remove all power query connections with DocumentInspector
    By beaglesBuddy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-27-2018, 05:17 PM
  3. Sub-Forum for Excel Power Tools (Power Query, Power Pivot & Power BI)
    By chullan88 in forum Suggestions for Improvement
    Replies: 10
    Last Post: 06-28-2018, 02:25 PM
  4. How to remove null values from several columns with Power Query?
    By toblju in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-12-2016, 11:08 AM
  5. Remove Unique rows in Power Query
    By danielmorrison in forum Excel General
    Replies: 2
    Last Post: 03-11-2016, 09:06 AM
  6. [SOLVED] Retain Order but Remove Duplicates
    By ssjagger in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-05-2014, 08:02 AM
  7. Replies: 5
    Last Post: 02-21-2013, 11:37 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