Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Create Calculated Field that Subtracts Field 1 from Field 2 (within same Column)

felixcaspari
7 - Meteor

I would like to create a calculated field (as displayed in column E) that locates the lowest system ID (column B) within a project ID (column A) and populates "E3" with the number found in the combined hours (column C) column. "E4" should be "C4" minus "E3". "E5" should be "C5" minus sum(E3:E4).

 

The process should be repeated for Project ID 2 starting in "E6".

 

I would like to point out, that system IDs are generated on a +1 basis, so you would never see a system ID that is smaller than its predecessor (within the same project ID) 

 

Calculated_Field_Alteryx_Community.png

 

I look forward to your responds- thank you in advance for the support.

 

 

4 REPLIES 4
cmcclellan
14 - Magnetar

2018-12-13 14_35_09-Alteryx Designer x64 - New Workflow3_.png

 

I'm pretty sure this is what you're after :) 

MarshallG
8 - Asteroid

They key to this is using the multi-row formula. First, sort by your project_ID and System_ID (you've already done that for us with your sample data) and then use a multi-row formula to compare the previous row's value for Combined_Hours. Workflow attached.

felixcaspari
7 - Meteor
 
felixcaspari
7 - Meteor

Thank you! This was very helpful and is working on my actual data set.

Labels
Top Solution Authors