Alteryx Designer Desktop Discussions

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

Why is my formula tool giving an incorrect result?

novalcia
7 - Meteor

I have a lot of pairs of Debit and Credit columns like so:

Screenshot 2024-02-15 084641.png

 

I want to find the unusual and usual ones, with the condition that:

- if ANY the Dr >0  AND the Cr >0, then Usual, else Unusual.

 

So my formula tool is like this:

Screenshot 2024-02-15 083843.pngScreenshot 2024-02-15 083850.png

 

I don't think there's anything wrong with the logic in the Formula tool? But I don't understand why the results would all be unusual, when in the screenshot above, all of the first four rows should have been usual because Dr 76>0 and Cr 76>0

 

When I tried using a sample data using text input, it works fine:

Screenshot 2024-02-15 084919.pngScreenshot 2024-02-15 084926.png

 

Why is Formula tool giving incorrect results when I'm using my original data? What's happening?

4 REPLIES 4
Qiu
20 - Arcturus
20 - Arcturus

@novalcia 
Never believe Brutal force😂
Here is a dynamic approach and hope it will help get started.

0215-novalcia.png

aatalai
13 - Pulsar

@novalcia in your second screen shot

 

part of your formula is sum dr2 >0 and in the data tab it is 0, hence the condition is not met, you might need to update it to >=0

 

also check that the field data is in float/double format

DataNath
17 - Castor

Hey @novalcia - the solution from @Qiu here is definitely a better approach as it's fully dynamic. However, to answer the issue at hand, this stems from incorrect use of parentheses as - if you do stick to your current approach - you need to separate each 'OR' into it's own check. See my blog here, particularly the final section of 'My AND/OR statement isn't returning the correct values!':

https://community.alteryx.com/t5/Engine-Works/Troubleshooting-Common-Formula-Expression-Errors/ba-p/...

novalcia
7 - Meteor

The second screenshot was the trial data I used, which works as expected.

 

The actual data I used is the first screenshot. The 76 and 77 pairs are supposed to be usual but it was categorized as unusual by alteryx.

 

The data are all in double format

Labels