Alteryx Designer Desktop Discussions

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

Absolute Value of Data in SQL Statement

abbymajercik
5 - Atom

I am looking to get the Absolute value of data before it is summarized through an SQL statement. I am trying to do this through a PRE SQL Statement as once I summarize the data through SQL the absolute value is the Absolute value of the summarized data. I am having problems with the Pre SQL Statement and unsure how to write that statement. Please let me know how to resolve this. 

1 REPLY 1
apathetichell
19 - Altair

Hi. I'm not 100% sure what you are looking for. If you want to do an absolute value before a summarize tool using in db - most DB's have a function you could use in a formula tool in-db like ABS("fieldname") and then you could use a summarize tool in-db after.

 

Likewise - you should be able to create a new column and then sum it something like

 

select sum(absolute_value_column) from (select ABS(my_column) as absolute_value_column from my_database)

 

specific SQL can vary.

Labels