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.
Solved! Go to Solution.
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:
Thank you @hannah_lissaman.
Now the order is correct.
Is there any way to keep the % symbol?
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:
So,
I've attached a workflow that'll help you workaround that issue in your workflow.
Output:
In case this solves your problem, kindly mark it as solution.
Regards
Benn
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:
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.
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