I need help handling a weekly workflow with dynamic data columns. Some weeks, these columns contain data that needs to be summarized in the output. Other weeks, these same columns may be empty. I want to ensure that:
1) When data is present, it gets summarized
2) When the column is empty, the summarize function should skip it without causing errors
Right now, if the column doesn't exist in a certain week, the Summarize tool breaks and causes an error.
Thanks!
Hi, @vivaisun11
Unfortunately, all field columns in the Summarize Tool are manually specified and fixed, so you can either use macros to complete this requirement or pre-set all possible field names (with a value of 0) first, so as not to cause errors in the Summarize Tool
Also, please upload template data to better illustrate your needs. Thank you!
@vivaisun11
It depends the way you use Summarize tool but normally we can use the combination of Transpose and Cross-Tab as shown below.
https://community.alteryx.com/t5/Alteryx-Designer-Desktop-Discussions/dynamic-summarize/td-p/482985
Hi @vivaisun11
A slightly different approach, using a Batch Macro and the Detour tools.
Assume this is your input normally:
If the summerised 'Count' column is empty, then it generates a 'True' return, otherwise a 'False' return. This is passed into the Batch Macro and updates the Detour tool to either send the data through the left stream (if the return is False) or through the right stream (if the return is True, i.e the summerised 'Count' column is empty)
The Summerize tool inside the macro simply groups by Values, and sums Count :
If there is no data in Count, then it passes the data straight through:
This is obviously an example situation, but you could hopefully tweak it to match your requirements
@vivaisun11
One useful very simple trick you can implement in 5 seconds: have an Ensure Field text input. I have attached the sample workflow.
