community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

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

Can we sum new column created in same formula tool

Hi All,

 

I am trying to create new column named (Qty Sum) in formula tool but at the same time adding the value of new column(Qty Sum) with another column value (Qty), basis on column named (Model Number), I have attached screenshot, please share you suggestion, how this could be achieved.


Thanks

Quasar
Quasar

hi @AJuliet101,

 

yes you can use a newly created field in a formula just add one "block" to the formula and it will work. In your example, I see that you make reference to the previous line, so I would advise you to use a multi-row formula allowing you to do this kind of tricks but you may need to use 2 multi-row or one + a formula tool, depending on what you want to achieve.

 

Hope it helped!

Nebula
Nebula

Hi @AJuliet101 

 

Here's a simple workflow that illustrates @Ladarthur's point

 

WF.png 

 

The configuration of the Multi-Row tool is as follows

 

multi.png

 

You create a new Integer field called Sum Qty and apply the same rules to the formula as you had in the Excel formula

 

if [Row-1:Model No.] = [Model No.] then
	[Row-1:Qty Sum]+[Qty]
else
	[Qty]
endif

 

If the previous row's Model No is equal to the current row's Model No then

    Add the current row Qty to the previous row's Sum Qty

Else

   Use the current row Qty

 

Results:

 

Results.png

 

 

Dan

Thanks Ladarthur,

 

I tried to use multi-row formula but failed to achieve the desired output, will look more into building the formula as well.

 

Thanks again.

Quasar
Quasar

hi @AJuliet101,

 

You could look at @danilang workflow, he did a formula which is working fine!

Thanks Danilang

 

I really appreciate for the solution you shared, will surely let you know if it works fine for me.

Labels