Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Filter out dupliacte by date

Hello,

 

I have a data source with an ID column and a date/time column, amongst others. Sometimes an ID can appear more than once, but the date will be different, and so may the other columns. I want to ignore all but the most recent instance of a record when the ID appears more than once. Is this possible in Power Query or DAX, and if so, how?

 

Thanks.

  • Hi Anonymous ,

     

    you can achive these with Power Query editor.

     

    This is an Example:

    1. Select the columns "ID", "lat", "longit", "Time" at the same time with "Ctrl".

    2. Click Remove Duplicates

     

     

    -------------------------------------------------------------------
    Did I answer your question? Mark my post as a solution!
    It was useful? Press Thumbs Up!

  • rainer1's avatar
    rainer1
    6 years ago

    Hi Anonymous 

    sry for the delay, the workaround is to add an index column after sorting before removing duplicates. This breaks query folding and forces it to operate in the order you just defined by your sort.

     

    -------------------------------------------------------------------
    Did I answer your question? Mark my post as a solution!
    It was useful? Press Thumbs Up!

3 Replies

  • rainer1's avatar
    rainer1
    Icon for Resolver III rankResolver III

    Hi Anonymous ,

     

    you can achive these with Power Query editor.

     

    This is an Example:

    1. Select the columns "ID", "lat", "longit", "Time" at the same time with "Ctrl".

    2. Click Remove Duplicates

     

     

    -------------------------------------------------------------------
    Did I answer your question? Mark my post as a solution!
    It was useful? Press Thumbs Up!

    • Anonymous's avatar
      Anonymous
      Not applicable

      rainer1  Thanks for your response. Which of the duplicates will it remove doing that? I always want to keep the most recent one.

      • rainer1's avatar
        rainer1
        Icon for Resolver III rankResolver III

        Hi Anonymous 

        sry for the delay, the workaround is to add an index column after sorting before removing duplicates. This breaks query folding and forces it to operate in the order you just defined by your sort.

         

        -------------------------------------------------------------------
        Did I answer your question? Mark my post as a solution!
        It was useful? Press Thumbs Up!