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

Weekly challenge 286 - My solution is total is correct but few individual line items vary

SandeepBabuS
8 - Asteroid

Hi Team, 

 

I have tried to solve the weekly challenge 286 - My solution is total is correct but a few individual line items vary.

Instead of using the Find Replace tool, I have used the Formula tool. The final answer is correct, but a few individual line items did not match.

 

Please attached files. One file belongs to me and the other one is the community solution file.

 

Please assist me.

5 REPLIES 5
acarter881
12 - Quasar

I'm not sure what you mean by a difference between your output and the solution.

 

Do you have the Expect Equals CReW macro? I attached it to this post.

See spoiler (Expect Equals does not return a difference between the solution and your output).

Spoiler
acarter881_0-1665779879062.png

 

SandeepBabuS
8 - Asteroid

Hi,

 

Thank you for the reply.

 

I apologize for the incorrect solution file provided in the initial post. Regret the inconvenience caused to you.

 

Please find the attached solution files.

 

OperativeCountOperative (My Sol))Count (My Sol)Count (T/F)
Raccoon114Raccoon114TRUE
Snake113Snake112FALSE
Rat45Rat46FALSE
Cat22Cat23FALSE
Possum16Possum16TRUE
Beaver15Beaver15TRUE
Jellyfish12Jellyfish12TRUE
Monkey11Monkey11TRUE
Eagle8Eagle7FALSE
Bat6Bat6TRUE
Bobcat5Bobcat5TRUE
Elephant4Elephant4TRUE
Slug4Slug4TRUE
Frog3Frog3TRUE
Lizard3Lizard3TRUE
Mouse3Mouse3TRUE
Cow2Cow1FALSE
Deer2Deer3FALSE
Fox2Fox2TRUE
Gopher2Gopher2TRUE
Leopard2Leopard2TRUE
Caterpillar1Caterpillar1TRUE
Chicken1Chicken1TRUE
Insects1Insects1TRUE
Microbes1Microbes1TRUE
Moose1Moose1TRUE
Mountain Lion1Mountain Lion1TRUE
Octopus1Octopus1TRUE
Shark1Shark1TRUE
Total402Total402 
     

 

 

Total FALSE6
Total TRUE23

 

Note: Please refer to Challenge# 286.

 

Please assist.

danilang
19 - Altair
19 - Altair

Hi @SandeepBabuS 

 

The difference comes down to the way the replacement was done.  The Alteryx solution replaces the Operative field only for those where it is originally "Animal".  Your solution performs the replacement in all the rows.  As an example of the difference in row 59, the Operator field is not "Animal" so the Alteryx solution doesn't change it.  

danilang_0-1665830864952.png

 

Your solution changes it to Deer because your IF statement looks like this

...
ELSEIF

(Contains([Article Title],'Deer', 1) OR
Contains([Operative],'Deer', 1))
THEN "Deer"
ELSEIF


(Contains([Article Title],'Eagle', 1) OR
Contains([Operative],'Eagle', 1))
THEN "Eagle"
ELSEIF

...

 

When processing line 59, the first clause that is true is the "Deer" one.  Your output field gets set to "Deer" and the statement moves on to the next row.  If you had put the "Eagle" clause before the "Deer" clause in your statement, that's the one that would have been used, setting the output field to "Eagle".

 

The totals match because there are 402 rows in the input and both of the solutions report on all the rows. 

 

Neither solution can be said to be wrong, because row 59 is ambiguous.  Does the phrase "deer with wings" refer to an eagle, or a deer that fell from a high place.   

 

Dan 

 

 

SandeepBabuS
8 - Asteroid

Thank you so much Dan. I have figured out the logical error in my expression. I have changed my expression (Expression: Animal5) in my workflow (Attached).   Also please check the tested data in the attached excel file and let me know your opinion.

 

Expression: Animal4 is the earlier one. 

Expression: Animal5 is the new one and it seems to be correct and to produce the correct output.

 

Thanks.

Sandeep Babu S

KarlHood
8 - Asteroid

done

Labels
Top Solution Authors