We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

How to create a field with simple math?

mlozovskaya
8 - Asteroid

I have 2 rows of data and I am trying to calculate the percentage by simply divide one to another and have a presentation showing as this input and output? Any suggestions?

 

Input

mlozovskaya_0-1640199824742.png

Desired Output

mlozovskaya_1-1640199855536.png

 

5 REPLIES 5
Kenda
16 - Nebula
16 - Nebula

Hi @mlozovskaya 

 

Attached is a workflow that includes two different possible ways to accomplish this. Either one could be modified to fit other scenarios you may have in your data. The first method uses a combination of the Cross Tab & Transpose tools while the other method utilizes a Filter + Append Records tool. 

 

Try these out and let me know if you have questions or still need assistance. 

mlozovskaya
8 - Asteroid

Thank you for sharing workflow, I was wondering if there is a shorter way to do it using multi-formula tool

Kenda
16 - Nebula
16 - Nebula

@mlozovskaya 

 

I had an idea! At first I didn't go that route because I was thinking you'd have to do some more manipulation to get the percent on the correct row, but I thought of a faster way to do it with a macro created by @patrick_digan 

 

First, create a blank row under your current data then use the multi-row formula row tool with this expression: 

iif(isempty([Column 1]), tostring(tonumber([Row-2:Column 2])/tonumber([Row-1:Column 2])*100) + "%", [Column 2])

 

mlozovskaya
8 - Asteroid

@Kenda  This is more simple solution, do you know how to add a row label for the new calculated value?

Kenda
16 - Nebula
16 - Nebula

@mlozovskaya 

 

You could add a formula tool to update Column 1 that says 

iif(IsEmpty([Column 1]), "Birch Tree %", [Column 1])

 

Labels
Top Solution Authors