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.
fireworks
SOLVED

In-DB Formula - SQL Server

suppahc
7 - Meteor

Hi,

 

I'm having trouble figuring out the right syntax. For instance, how can I create column that takes the difference between two existing columns? Only thing I've been able to figure out is using LEFT("X",1) to build a new variable. 

6 REPLIES 6
apathetichell
20 - Arcturus

`column1`-`column2`

 

?

 

Do you have to cast your columns as numbers first (ie are they strings?)

 

cast("column1" as int)-cast("column2" as int)

 

 

suppahc
7 - Meteor

Is there a way to tell what the format is for In-DB? Or do you just have to know the underlying table? I don't think they are stings because I can summarize / sum them within the DB.

suppahc
7 - Meteor

"Column1" - "Column2" doesn't work. I can see they are doubles in the summarize tool so that isn't the case. Could there be some permissions issue that doesn't allow me to do it but will allow me to do LEFT("Column3",1) without an error?

alexnajm
18 - Pollux
18 - Pollux

Hi @suppahc,

 

It shouldn't be a permission issue - the subtraction works for me. Are you giving the new column a name and outputting it as a Double? See the configuration below:

 image.png

suppahc
7 - Meteor

Can't have spaces.

 

I had:

"Col1" - "Col2"

 

When I took out the spaces it work.

 

Thanks so much!

alexnajm
18 - Pollux
18 - Pollux

Fantastic @suppahc😊

Labels
Top Solution Authors