We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Removing Duplicate Values in a Column Based on Values in Other Columns

jlinkkpmg
6 - Meteoroid

Hi all,

 

I'm trying to figure out how to remove a duplicate value in the Liability column based on the what is in the Award ID and Country columns.  See example below.

 

Award IDCountryLiabilityApportioned Award
1US1,0007,500
1US1,0002,500
1UK5,0001,000

 

I thought perhaps this could be done with a Multi-Row Formula, but I'm getting an error.

IF [Row-1:Award ID] = [Award ID]
AND [Row-1:Country] = [Country]
AND [Row-1:Liability] = [Liability]
THEN [Liability] = "0"

 

Once run, i would expect the results to look like:

Award IDCountryLiabilityAppoortioned Award
1US1,0007,500
1US02,500
1UK5,0001,000

 

Any suggestions?

 

Thank you.

5 REPLIES 5
RodL
Alteryx Alumni (Retired)

Finish the expression with ENDIF.

 

And you may already have done this, but as a helpful hint, I would put a Sort tool right before the Multi-Row Formula tool to ensure that your groupings are consistent.

patrick_digan
17 - Castor
17 - Castor

@jlinkkpmg I agree with @RodL. I've put his fix into a little workflow. By the way I personally prefer the IIF formula because I never have to type then/else/elseif/endif. In your case:

IIF([Row-1:Award ID] = [Award ID]
AND [Row-1:Country] = [Country]
AND [Row-1:Liability] = [Liability]
,[Liability] = "0"
,[Liability])

I also added another way to do it using a unique tool. I find this tool very powerful. Just my 2 cents

jlinkkpmg
6 - Meteoroid

Thanks to both for the quick replies.

rahamrahimi
5 - Atom

Capture.JPG

robertbrussell1
6 - Meteoroid

This was very helpful!  I've been researching a similar issue and needed to remove duplicates if the Date Difference between duplicate record is >= 30 days.  

 

After sorting by Date (Ascending), I applied the Multi-Field Formula tool and included the following statement:

 

IF [Row-1:ID] = [ID] 
AND [Row-1:TYPE] = [TYPE]

THEN DateTimeDiff([DATE],[Row-1:DATE],"days")

Else Null()

Endif

 

This data can now be filtered accordingly.

 

Labels
Top Solution Authors