Alteryx Designer Desktop Discussions

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

Alteryx rounding function

Carluccio555
9 - Comet

This formula is failing:

 

round([Gross Margin]/[Gross_Revenue]*100,0.1)

 

Is it because the round function can only accept 1 field as an input? If not how can I make it work?

 

 

 

 

3 REPLIES 3
flying008
14 - Magnetar

Hi, @Carluccio555 

 

Please try this formula:

Round(ToNumber([Gross Margin])/ToNumber([Gross_Revenue])*100,0.1)
apathetichell
18 - Pollux

@Carluccio555what @flying008 is saying is that you the most common reason that your formula would fail is that one or both of your fields are not numbers. tonumber() will convert them to numbers.

 

If these are both numbers - you can also add a check to see if you are dividing by zero by saying:

 

if [Gross_Revenue]!=0 and !isnull([Gross_Revenue]) then ... (insert your nifty formula here) else 0 endif

DenisZ
11 - Bolide

To make it easier to troubleshoot it would be nice to see what the issue is. Immediately, there appears to be no issue, but I could assume that they are going in as V_WString and not a Double/Int, so maybe try ToNumber([GrossMargin]) And ToNumber([Gross_Revenue])

 

Hope it helps. 

Labels