Remove duplicate rows with condition

Delarc

New Member
Joined
Jan 6, 2021
Messages
11
Office Version
  1. 365
Platform
  1. Windows
Daily I fill in a new row in Table1 with data from an external query (Power Query).
In column A I save the date and in columns B, C and D some values that I get.
I want if the B, C and D values have not changed since the last query, then a new row is not added and the data is discarded.
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Hi C Moore! Thank you very much for your answer.
I will try to explain myself better.

1616788697491.png

In the example Table, assuming that the data from the last external query is the one indicated in the row with a green background date, using the Remove Duplicates Rows would delete all the rows with a light blue background and leave the oldest (ocher background) .
What I am looking for is that if the values (VAL 1, VAL 2 and VAL 3) of the previous query (in the example the one dated 2021-03-24) are the same as the current one, the new values are discarded
1616788991795.png

In other words, only keep the values on the dates that there was at least one change.
I hope I have explained myself ... my English depends on the Google translator.
 
Last edited:
Upvote 0
Hi there. I tried approaching your question through this:
//

let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}, {"Val 1", type number}, {"Val 2", type number}, {"Val 3", type number}}),
#"Sorted Rows" = Table.Sort(#"Changed Type",{{"Date", Order.Descending}}),
#"Added Index" = Table.AddIndexColumn(#"Sorted Rows", "Index", 1, 1),
#"Added Custom" = Table.AddColumn(#"Added Index", "Custom", each [Val 1]+[Val 2]+[Val 3]),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "Formula", each List.Sum(List.Range(#"Added Custom"[Custom],[Index],1))),
#"Added Custom2" = Table.AddColumn(#"Added Custom1", "Is Equal to previous record", each [Custom]=) in #"Added Custom2" // Beyond this you just need to filter out the logical output TRUE. Cheers.
 

Attachments

  • aa.PNG
    aa.PNG
    23.4 KB · Views: 7
Last edited:
Upvote 0
Something like:

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    ChangedType = Table.TransformColumnTypes(Source,{{"Date", type date}, {"V1", type number}, {"V2", type number}, {"V3", type number}}),
    Row0 = {ChangedType{0}[V1], ChangedType{0}[V2], ChangedType{0}[V3]},
    Row1 = {ChangedType{1}[V1], ChangedType{1}[V2], ChangedType{1}[V3]},
    RmDupTop= if (Row0=Row1) then Table.Skip(ChangedType,1) else ChangedType
in
    RmDupTop
 
Upvote 0

Forum statistics

Threads
1,223,723
Messages
6,174,108
Members
452,544
Latest member
aush

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top