Forum Discussion

hawkeyes12's avatar
hawkeyes12
Frequent Visitor
7 years ago

How do I move data to two rows into one OR just move a certain value out of a column in Power Query?

Hello,

 

I have a large table (22 columns and +250 rows of data). I have the data *almost* formatted how I want it, except each unique value has two rows, which I need combined into one.

 

Unfortunately, I can't filter on any column to reduce the rows into one, because there is a column ("Entity") that contains data I need, but is in the opposite row of all of the values I need to keep. Here is an example of the data that I have in my table (note that all columns are not shown and that there are no numbers that I need to sum, add, etc.)

 

 

Can you please advise?

 

3 Replies

  • v-piga-msft's avatar
    v-piga-msft
    Icon for Resident Rockstar rankResident Rockstar

    Hi hawkeyes12 ,

    For your requirement, please have a good look at this video which introduces how to Concatenate, Merge or Combine multiple rows into one value with Power Query.

    If you still need help, please share your data sample as table format and your desired output so that I could have a test on it.

    Best  Regards,

    Cherry

  • It looks like you can get what you want with following procedure:

    1. 'Fill Up' on one of the unique identifier columns
    2. split into two tables with filter (e.g. [Reference Key] = "Entity"   |   [Reference Key] <> "Entity")
    3. Join two table on the unique identifier column you filled up
    4. Expand the join column to get the additional info on one row per identifier

    Note this only works if the order by the index is as you showed it, where the two lines are always together, and the row without the identifier is always above the row with the identifier.

  • v-piga-msft's avatar
    v-piga-msft
    Icon for Resident Rockstar rankResident Rockstar

    Hi hawkeyes12 ,

    Have you solved the problem?

    If you have solved, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.

    If you still need help, please feel free to ask.

    Best Regards,

    Cherry