Important Community update: The process for changing your account details was updated on June 25th. Learn how this impacts your Community experience and the actions we suggest you take to secure your account here.

Alteryx Designer Desktop Discussions

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

Input has Null and 0 Values in column - Help with the Column update

EmilDem01
8 - Asteroid

I have columns with NULL and 0 values, and I need to Total Marks to reflect the Marks as below. Note 1) there will either Maths or Science marks (never both) and 2) If the status is Deleted it will reflect as 0 in the input but I want the total to reflect

 

Input: 

StatusMaths Science Total Marks
Good100[Null][Null]
Good100[Null][Null]
Good[Null]250[Null]
Good200[Null][Null]
Good[Null]450[Null]
Good[Null]500[Null]
Good[Null]600[Null]
Good[Null]750[Null]
Good[Null]100[Null]
Good0500500
Good7500750
Good6000600
Deleted75000
Deleted05000
Good0500500
Good7500750
Good6000600

 

Output: 

StatusMaths Science Total Marks
Good100[Null]100
Good100[Null]100
Good[Null]250250
Good200[Null]200
Good[Null]450450
Good[Null]500500
Good[Null]600600
Good[Null]750750
Good[Null]100100
Good0500500
Good7500750
Good6000600
Deleted7500750
Deleted0500500
Good0500500
Good7500750
Good6000600

 

2 REPLIES 2
EmilDem01
8 - Asteroid

Also - I would need an addtional column for Subject - if the Marks are in Maths then M or S if Science 

 

StatusMaths Science Total MarksSubject
Good100[Null]100M
Good100[Null]100M
Good[Null]250250S
Good200[Null]200M
Good[Null]450450S
Good[Null]500500S
Good[Null]600600S
Good[Null]750750S
Good[Null]100100S
Good0500500S
Good7500750M
Good6000600M
Deleted7500750M
Deleted0500500S
Good0500500S
Good7500750M
Good6000600M
BS_THE_ANALYST
14 - Magnetar

Quite an interesting one @EmilDem01.

 

If you just want to add the columns across the rows, it will return null if there's a null in there.

 

However, the summarize tool behaves as you would expect if you have nulls (it will ignore them and perform the addition): if you were to pivot your data and then summarize. I think the same holds true with pivoting your data (transpose) and then cross-tabbing it; I'd use a record ID before this transformation, though. Note: these routes are dynamic which accounts for more columns needing to be added overtime.

 

If you didn't want to pivot your data (nor did you want to replace your null values with 0s) you could use this formula below: (this seems to handle nulls which is interesting)

Simply taking the average and then adjusting it by multiplying it by the number of columns used. Note: this can still be dynamic, but requires the use of a batch macro to make it dynamic.

Screenshot 2024-06-08 124033.png

there's many routes to tackle this. I normally go for the pivoting option but this could be problematic for big data. It just depends on your situation.

 

All the best,

BS

Labels