Alteryx Designer Desktop Discussions

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

Writing lots of formula within alteryx

TKM
5 - Atom

Hi everyone, I have a task where I am required to write multiple formula but I really do not want to.

 

I have a total of 12 months of data in 2023 and 2024 Jan to Dec (total of 24 columns) and I have to do the following formulas

 

1. Jan 23 vs Jan 24 in absolute value (12 additional columns)

2. Jan 23 vs Jan 24 in % value (12 additional columns)

3. Jan 23 vs Feb 23 in absolute value (11 additional columns) 

4. Jan 24 vs Feb 24 in absolute value (11 additional columns)

5. Jan 23 vs Feb 23 in % value (11 additional columns)

6. Jan 24 vs Feb 24 in % value (11 additional columns)

 

and come 2025 there will be a need to easily roll up the formula to create 25 vs 24.

I do not wish to write them individually and I can't think of an easy way to quickly do them up. Anyone have any ideas? Thanks a lot in advance!

5 REPLIES 5
flying008
14 - Magnetar

Hi, @TKM 

 

Maybe you can upload some input sample data with header for try? 

TKM
5 - Atom

Hi, sorry I forgotten to add the data, have added it into the main post! Thanks!

flying008
14 - Magnetar

Hi, @TKM 

 

Finally, I was done with what seemed like a lot of work, but it wasn't that scary, as long as you figured out the logic.

- Due to the security policy, I can't upload the workflow file, so I'll show you the configuration animation.

- Since you use 2 basic data tables according to your needs, they are also attached below, and you can copy and use them.

- If you want to use data from another year such as 2025, you can add it to the source data first, and then replace the desired year with the Replace function of the Formula tool before the Append Fields tool, which is very simple.

 

 Call Field Name  Months table 
GroupFieldName IDXY
1Difference X 23 vs X 24 1JanFeb
2Difference X 23 vs X 24 (%) 2FebMar
3Y 23 vs X 23 (Absolute) 3MarApr
4Y 23 vs X 23 (%) 4AprMay
5Y 24 vs X 24 (Absolute) 5MayJun
6Y 24 vs X 24 (%) 6JunJul
   7JulAug
   8AugSep
   9SepOct
   10OctNov
   11NovDec
   12Dec 

 

录制_2024_03_21_14_02_07_828.gif

 

TKM
5 - Atom

Hi, thanks for your input. Took me awhile to understand the logic behind it and working it out to know that this really works and it saved a lot of time. Didnt knew that dynamic replace can be used to create formula. Thanks a lot! :D

TKM
5 - Atom

hi @flying008, not too sure if you are able to help on the request, i have dropped my workflow and data within, i am almost done but my data is slightly more complex. as i simplified my scenario above. was wondering if you can take a look on how should i fix the logic as i cant get the dynamic rename to function per intended. 

Labels