Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

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

Compare values on a certain date

Andre2020
5 - Atom

Hi all!

I have a database looking as follows

 

IDCountryDateValue
1Germany01/01/202010
2Germany02/01/202015
3Germany02/01/20203
4Germany03/01/202017
5France01/01/202025

 

I am trying to create a formula that will allow me to select the value for the same country and on the same date that is most possibly between the value for the same country on the day before and the day after the given date.

 

So in this example, I am looking for a formula that will help me deleting the value "3" for Germany on 02/01/2020, and keep the value "15" for Germany on 02/01/2020. 

 

Please note that I have more than 100 countries in the database, and each date will appear for every country. 

 

Could anyone help with some suggestions? So far I have been able to isolate the duplicate values (used this), but I can't figure out how to remove the incorrect one.

 

Thanks a lot & have a great day!

2 REPLIES 2
grossal
15 - Aurora
15 - Aurora

Hi @Andre2020,

 

I think I got something for you:

 

grossal_0-1586079961028.png

 

The Main Formula is:

 

IF not ([Row-1:Date] = [Date] AND [Row-1:Country] = [Country])
THEN "No"
ELSEIF ABS(([Row-2:Value] + [Row+1:Value]) / 2 - [Value]) < ABS(([Row-2:Value] + [Row+1:Value]) / 2 -[Row-1:Value])
THEN "Previous" 
ELSE "Yes" 
ENDIF

 

What I try to do: I add the one before the same and the one after it together, build the average from them and subtract the current value. The one that is lower will be the one that fits better in the row. I think you need to test it on a bigger sample and see if the logic applies on the bigger scale.

 

The seconds formula just replace the "previous" with "yes" to filter them. Note: This won't clear up the 'previous' in the Remove column, but you don't need to clean them up, you will most likely deselect the column.

 

 

Workflow attached. Let me know what you think.

 

Best 

Alex

Andre2020
5 - Atom

Thank you Grossal, this works! 🙂 

 

Have a great day!

Labels