Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

I need to split one line item in years between two dates and make rows based on the years

Mahesh6279
7 - Meteor

Turn one row into 4 rows based on the start and end year

 

Mahesh6279_0-1686905201984.png

 

6 REPLIES 6
ed_hayter
13 - Pulsar

ed_hayter_0-1686905732338.png

 

 

generate rows is the tool to use here. For your example you will want to add a year on in your date time add

 

we create a new field date, and use the start date as our initial expression. New field date is less than or equal to end date is our condition for it to keep running. I.e. stop when date is past end date. And the expression to loop is a datetime add where we add a day to our date each loop.

ed_hayter_0-1686907423486.png

 

PhilipMannering
16 - Nebula
16 - Nebula

Hi @Mahesh6279 

 

The generate rows tool should help here,

PhilipMannering_0-1686905904306.png

 

FrederikE
13 - Pulsar

Hey @Mahesh6279,

 

This is one way to do it: 

This ensures that Start and End are kept from the original dataset.

FrederikE_0-1686906182373.png

 

Mahesh6279
7 - Meteor

Thank you for the reply, I need the End date to reflect the 12-31 of the same year it started. Example in 2021 it started from 1-1-2021 and ends in 12/31/2021. Appreciate you help.

 

Mahesh6279_0-1686909144854.png

 

FrederikE
13 - Pulsar

Hey @Mahesh6279,

 

You can just subtract a day again in a similar fashion as the proposed solutions. See the attached WF. 

Mahesh6279
7 - Meteor

Worked like charm. Thank you for the support

Labels
Top Solution Authors