Forum Discussion

MXSven's avatar
MXSven
Icon for Helper I rankHelper I
3 years ago
Solved

How to merge 2 rows into one for each date

Hi Everybody,
I have a dataset where I have in many cases two information per date,
but not always as in the first row.

How can merge rows that have the same date ?
I already tried different combinations of unpivot/pivot column, but without success.

Any suggestion ?

  • Can you please try fill up for portfolio 1 column and fill down for portfolio 2?
    It will replce null with next values in portfolio 1 and replce null with previous values in portfolio 2.
    Then you can remove duplicated from both of the columns portfolio 1 and portfolio 2.
    You can also remove Index column if it is of no use.
    This will eventully solve your problem.

    And if you have more data then please post with some more data as this logic will work if all of your data follows the same pattern like above picture.
    Try this and please let me know if you have any queries.

2 Replies

  • KeyurPatel14's avatar
    KeyurPatel14
    Icon for Responsive Resident rankResponsive Resident

    Can you please try fill up for portfolio 1 column and fill down for portfolio 2?
    It will replce null with next values in portfolio 1 and replce null with previous values in portfolio 2.
    Then you can remove duplicated from both of the columns portfolio 1 and portfolio 2.
    You can also remove Index column if it is of no use.
    This will eventully solve your problem.

    And if you have more data then please post with some more data as this logic will work if all of your data follows the same pattern like above picture.
    Try this and please let me know if you have any queries.

    • MXSven's avatar
      MXSven
      Icon for Helper I rankHelper I

      thanks you very much,
      so easy to implement, while I was already thinking about scripting