Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
JollyRoger01
Helper III
Helper III

How to remove two rows based on their specific values i.e. remove a payment that later gets refunded

I am trying to reconcile PayPal statements against a bank account and just want to get a list of incoming and outgoing transactions. To do this I need to weed out the refunds from that occur at a later date.

 

I'd like to write some code that goes something like this:

 

If current row name contains "Refund" then record that amount value.

Find another row with the opposite value.

Delete both lines.

Repeat for all lines.

 

Does anyone know how I write that?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @JollyRoger01 ,

 

I created this sample data.

Screenshot 2021-05-25 103244.png

The result is this.

Screenshot 2021-05-25 103433.png

 

The method is to first find out the number with Refund, and then add a custom number to turn the found out number into the opposite. Then add the opposite sequence as a new query.

Screenshot 2021-05-25 104213.png

Turn the list into a table. Then use merge to merge the two tables, filter and delete redundant columns.

Screenshot 2021-05-25 104515.png

 

Best Regards,

Stephen Tao

 

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

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @JollyRoger01 ,

 

I created this sample data.

Screenshot 2021-05-25 103244.png

The result is this.

Screenshot 2021-05-25 103433.png

 

The method is to first find out the number with Refund, and then add a custom number to turn the found out number into the opposite. Then add the opposite sequence as a new query.

Screenshot 2021-05-25 104213.png

Turn the list into a table. Then use merge to merge the two tables, filter and delete redundant columns.

Screenshot 2021-05-25 104515.png

 

Best Regards,

Stephen Tao

 

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

That's perfect, thanks so much for your help on this!

 

This makes my transaction records more accurate as I'm not recording credits and debits that didn't really occur.

AlB
Community Champion
Community Champion

Hi @JollyRoger01 

Do you want to show some sample data and the expected result?

I'm guessing you'll have to do something more than just look for a row with the opposite value. What if there are values that appear more than once, which one does the refund belong to?

 

SU18_powerbi_badge

Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

 

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.