Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

Merge a row with the previous one

Hello,

 

I am new to Power BI and I struggle merging some rows.

 

I have rows which have a column name in it and the actual data of those columns in the next line, like this:

 

 

 

 

 

 

 

 

 

 

 

 

 

I want to replace those Title1 and Title2 by the actual data that's below. So far, I replaced the titles with null and renamed the columns, so it looks like that:

 

 

 

 

 

 

 

 

 

 

 

Now I want to merge the data with a null key with the row above.

Any idea of how to do that in Power Query?

 

Thanks

  • Hi Anonymous,

    Another way (if the null for key 2 and 3 are necessary to be kept) is to use some other string (or value) that is not in the dataset as a marker instead of null when replacing the TITLE1 and TITLE2 for example 'ZZZZZ'.

    Then you can fill down on the UniqueKey column.

    Then you can filter out the marker text from the Table1 and Table2 columns.

     

4 Replies

    • ImkeF's avatar
      ImkeF
      Icon for Community Champion rankCommunity Champion

      In this case, "Fill up" will do: check your columns (except the KeyCol) -> right click your mouse -> Fill -> Up

  • MarkS's avatar
    MarkS
    Icon for Resolver IV rankResolver IV

    Hi Anonymous,

    Another way (if the null for key 2 and 3 are necessary to be kept) is to use some other string (or value) that is not in the dataset as a marker instead of null when replacing the TITLE1 and TITLE2 for example 'ZZZZZ'.

    Then you can fill down on the UniqueKey column.

    Then you can filter out the marker text from the Table1 and Table2 columns.

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Thanks for the answers. I did a Fill down on the Key column and other columns I need.

     

    ImkeFMaybe my exemple was not exhaustive enough, but Fill up on the columns would not work in my case because Column 4 can be null sometimes, and in that case I don't want the data to be duplicated in the line above that has a different key.