In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests after December 31, 2025. Make sure to check your account preferences in my.alteryx.com to make sure you have filled out your security questions. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

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

Change a string cell to a percentage calculation

salemalnahdi14
6 - Meteoroid

Hi,

 

I am trying to do the following but not sure how to approach. I have a cell that has a list of Y's and N's, and I want to change the cell to a percentage of Count(Y)/Count(X), while still keeping the Count(Y) as number.

 

For example I have the following data set.

 

ClientY/N
XY,Y,N
YY, Y
ZN
AY

 

I want the workflow to output the following:

ClientY/N
X66% (2)
Y100% (2)
Z0% (0)
A100% (1)

 

Appreciate any help, thanks!

5 REPLIES 5
DataNath
17 - Castor
17 - Castor

Hey @salemalnahdi14, here's one way you can go about it. Please let me know if you're looking for something else!

 

DataNath_0-1666797031005.png

 

If you're precious about the order of the Clients, just add a RecordID, pull it through and sort upon it just before the end like so:

 

DataNath_0-1666797191114.png

 

Both workflows attached.

JamesCharnley
13 - Pulsar

Hi @salemalnahdi14 

 

Here's how I would do it, looking for the total counts and count of Y then turn it into a string in the formula:

 

JamesCharnley_0-1666797130460.png

 

Carlithian
11 - Bolide
11 - Bolide

So you can do it in one formula which is pretty nice, hope this helps

 

Carlithian_1-1666797113642.png

ToString(Round((REGEX_CountMatches([Field1], 'Y')/REGEX_CountMatches([Field1], '[A-Z]')*100),2))+ '% ' +'(' + Tostring(REGEX_CountMatches([Field1], 'Y')) + ')'

 

Happy Alteryxing

 


Happy Alteryxing
Luke_C
17 - Castor
17 - Castor

Hi @salemalnahdi14 

 

Here's my take:

Luke_C_0-1666797344267.png

 

 

salemalnahdi14
6 - Meteoroid

Thanks this is very helpful!

Labels
Top Solution Authors