Alteryx Designer

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

Sort with wrong output

Highlighted
5 - Atom

Hello,

 

I have applied the sort toot for ascending data in percentage.

All percentage are correctly put (from lower to higher) except one that is outputting randomly in the middle of the other percentages.

So I have:

78,98%

64,45%

6,11%

45,56%

 

Please help me understand what I am doing wrong.

Thank you.

 

 

Highlighted
Alteryx Certified Partner

Hi @Stef436 

 

It looks like your percentages are stored in a text format rather than a number format. Alteryx is sorting the alphabetically, rather than numerically.

 

To fix this, you will need to convert them to a number format - note that this will remove the percentage symbol.

 

You can use a Select tool to do this. Change your Type to Double: 

Hannah_Lissaman_0-1589537080005.png

 

Highlighted
5 - Atom

Thank you @hannah_lissaman.

Now the order is correct.

Is there any way to keep the % symbol?

Highlighted
8 - Asteroid

Hi Stef,

That is happening as Alteryx is reading that column as a String and basically sorting it basis the first number in the cell like,

7,6,6,4.

 

See below:

Bennel_Wilson_0-1589537703083.png

 

So,

I've attached a workflow that'll help you workaround that issue in your workflow.

 

Output:

Bennel_Wilson_1-1589537841230.png

 

In case this solves your problem, kindly mark it as solution.

 

Regards

Benn

Highlighted
5 - Atom
Thank you.
Highlighted
Alteryx Certified Partner

Hi @Stef436 

 

You would need to add it back again afterwards. 

 

First, use a Select tool to convert your data back to text. Make sure that you also adjust the Size column to a larger number - it will default to the exact size of your current longest string, but we need to be able to add more characters:

Hannah_Lissaman_0-1589538376133.png

 

Next you can use a Formula tool to add % sign with the expression: [Field1] + "%"

 

In general, when working with Alteryx I would recommend keeping your numbers in number formats, i.e. without the % sign. Many tools and formulas will not work if your data is stored as text. If you would like to have the % sign in your output, I recommend adding this as a final step.

Highlighted
8 - Asteroid

Hi @Stef436 ,

Also like @Hannah_Lissaman mentions, do this only as the last step in your workflow so that it doesn't disturb any operations you might have after this step on this column.

 

Regards

Benn

Labels