Forum Discussion

Sab's avatar
Sab
Helper V
4 years ago

Compare rows in Power Query

Hello all,

 

As you can see from the image, I need to take the value from the Date column into the new column I am creating, if the value in the subsequnet row is different than the actual row.

 

The easy part is done, so when the Costs is zero then all good. I tried the formula you see, but it takes into consideration only the first part, so If [Costs] = 0.

 

Thank you!

 

ImkeF 

3 Replies

  • HotChilli's avatar
    HotChilli
    Community Champion

    I think it's best if you debug this by simplifying the code in the column.

    Save your column code elsewhere and then test just the reference to the previous row.  If i was you I would even remove the comparison and just get the value from the previous row.  It might not be what you think it is.

  • ImkeF's avatar
    ImkeF
    Community Champion

    Hi Sab ,
    I would recommend to add a column that contains the value from the previous row. Then you can write out your logic for the new column with references to the current row only.
    If performance matters, you have to use this function to retrieve the value from the previous row: 
    https://wp.me/p6lgsG-Vo

     

  • Hi, Sab 

     

    May I ask if your problem has been solved? Is the above post helpful to you?

    If  it does, could you please mark the post which help as Answered? It will help the others in the community find the solution easily if they face the same problem with you. Thank you.

     

     

     

    Best Regards,
    Community Support Team _ Zeon Zheng

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.