Alteryx Designer Desktop Discussions

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

Round Off

Divyajyothi7
7 - Meteor

hi

 

I have following data set with multiple columns

 

A   A%BB%CC%
2.456661.87654%3.68912.3364788%6.456710.456733%

 

I would round off the data using multi field formula
i have used this formula
ToString(Round(ToNumber([_CurrentField_]), 0.01)) + '%'

 

for this formula all columns are getting % symbol

i would like to add % symbol only for those columns with %

8 REPLIES 8
caltang
17 - Castor
17 - Castor

You can use a Multi-Field Formula, and you can select the Fields of interest for you to convert them. 

 

If you'd like to fully automate it, then you can use a combination of Tranpose Tool + IF Contains([Name],"%") THEN your formula to include %, else do not include. 

 

If you'd like, kindly provide some sample data and we can show you how. There's two ways about it, really depends on your preference. Though the latter is more automated.

Calvin Tang
Alteryx ACE
https://www.linkedin.com/in/calvintangkw/
binuacs
20 - Arcturus

@Divyajyothi7 One way of doing this with Transpose and Cross Tab tools

binuacs_0-1686206783420.png

 

Qiu
20 - Arcturus
20 - Arcturus

@Divyajyothi7 
Just add to @caltang We can make a more dynamic by using conditional statement.

0608-Divyajyothi7.PNG

Divyajyothi7
7 - Meteor

@Qiu from your formula only % columns are getting roundoff

I would like to roundoff all the columns which are in string format

i have updated the formula but non % columns are not changing

 

if contains([_CurrentFieldName_],'%')
then ToString(Round(ToNumber([_CurrentField_]), 0.01)) + '%'
else ToString(Round(ToNumber([_CurrentField_]), 0.01))
endif

sparksun
11 - Bolide

Here is my solution.

sparksun_0-1686211069521.png

 

binuacs
20 - Arcturus

@Divyajyothi7 The amount which contains % are in string type and the rest are in double, in that case, the above formula should work. Can you provide your sample file with and expected output?

Divyajyothi7
7 - Meteor

@binuacs 

Please consider all columns as string

I have sorted the data before, I don't want use any new crosstab or transpose tools

 

is it possible to solve using multifield formula?

so that my order of columns won't change

 

binuacs
20 - Arcturus

@Divyajyothi7 Attached the updated workflow

binuacs_0-1686213221940.png

 

Labels