Alteryx Designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
It's the most wonderful time of the year - Santalytics 2020 is here! This year, Santa's workshop needs the help of the Alteryx Community to help get back on track, so head over to the Group Hub for all the info to get started!

Replicating a For Each Loop in Alteryx?

7 - Meteor

I had posted this question yesterday, but couldn't readily try out the offered solution, and have now realized that it would not work. I'll try to give more detail in this post.


I'm trying to find a way to replicate a For Each loop. I need to be able to take the average of the volume for specific members for each as of date, and display this average for all member statuses. However, member statuses other than "Member" will not be included in the average.




For Each as of date

If Plan = 1 and Member Status = Member, then Average(volume)

If Plan = 2 and Member Status = Member, then Average(volume)


End if

Next as of date


I don't believe a simple summarize would work, unless I can request the specific members within the summarize somehow. I have attached a simple sample of how I want the end product to look.


Appreciate any help on this!


14 - Magnetar
14 - Magnetar

Hi @Bnstates 


Doesn't look like you'd need a macro here. You can use a combination of the Filter and the Summarize tools.


First drop a Filter tool, and filter for where Member Status Equals Member


Next, add the Summarize tool, with Plan number and As of date as Group by fields, and Volume as an averaged field.




You can join this back to your original data, joining on the Plan # and As of date fields. That will add the average volume to each record for each plan number and as of date.


Let me know if that helps!