Forum Discussion

Power_BI_new's avatar
Power_BI_new
Frequent Visitor
3 years ago
Solved

Duplicate rows in Power Query

Good morning πŸ™‚, I have a database with steps applied to it on Power Query, I would like to add one last step to: duplicate all the rows of my table whose "Account number" column begins with 6 or...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Say you are at step name FullTable. Just filter to include only the accounts you want to duplicate, name this step Filtered, and then

     

    = Table.Combine({FullTable, Filtered})

     

    You can refer to any step in any order.

     

    --Nate

  • Kmcdonald's avatar
    3 years ago

    Hi Power_BI_new,

    I put together your example provided to show you how I achieved this differently than the other suggestions.

     

    So once I put together the data in an xlsx file, I started with the sample below. Please note that I had formatted the "Account Number" column as text.

     

     

    So the first step was that I clicked the "Add Step" button to create a starting point and named the new step, "--original_data".

     

     

    Then I used a filter on the "Account Number" column, using the text filter begins with a 6 or 7.

     

    Then I appended the current query onto itself.

     

     

    Then as the last step, when you select the append query step it will show the name of the query twice. So I changed one of those names to the "--original_data" step name, that I name in the first step.

     

    from:

     

    to:

     

    This is my final result, which I believe matches what you are trying to acheive.

     

     

    If I'm not coming accross clearly, happy to share the pbix file I put together if you have somewhere I can drop it πŸ™‚

    If you need to, you can change the account number back to a whole number format.