We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Dynamically subtract columns

Ronit_Gupta
7 - Meteor

I have columns name 2024-1, 2024-2,...., 2024-12, 2025-1, 2025-2, ....., 2025-12. I want have 12 columns in output

Output column1: [2025-1] - [2024-1]

 Output column2: [2025-2] - [2024-2]

.......

Output column12: [2025-12] - [2024-12]

 

I am trying multifield formula tool but I couldn't achieve the result.

4 REPLIES 4
Qiu
21 - Polaris
21 - Polaris

@Ronit_Gupta 
Can you provide a sample dataset for input and output?

OTrieger
14 - Magnetar

@Ronit_Gupta 
You can do it with the normal Formula tool but then it will not dynamic automation, as it will work only for this year.

If you want it to be dynamic you will need first to rename the headers

Connect a Field Info tool and then a RecordID Tool, along as your files containing only 24 headers for the months, you will always have 24 static headers that you can use to rename your fields, then set these header in Formula tool and you have solve the issue

 

 

flying008
15 - Aurora

Hi, @Ronit_Gupta 

 

There is a full dynamic resolution for you:

 

录制_2025_02_21_16_07_14_604.gif

 

Input                       
2024-12024-22024-32024-42024-52024-62024-72024-82024-92024-102024-112024-122025-12025-22025-32025-42025-52025-62025-72025-82025-92025-102025-112025-12
102030405060708090100110120123456789101112
                        
Output                       
[2025-1] - [2024-1][2025-2] - [2024-2][2025-3] - [2024-3][2025-4] - [2024-4][2025-5] - [2024-5][2025-6] - [2024-6][2025-7] - [2024-7][2025-8] - [2024-8][2025-9] - [2024-9][2025-10] - [2024-10][2025-11] - [2024-11][2025-12] - [2024-12]            
-9-18-27-36-45-54-63-72-81-90-99-108            

 

Qiu
21 - Polaris
21 - Polaris

@Ronit_Gupta 
I tried another approach as below.
The point is to seperate the Year and Month from your data input then use the Summarize tool to get the desired output and moditied the header name with Dynamic Rename tool.

0221-Ronit_Gupta.png

Labels
Top Solution Authors