Start Free Trial

Alteryx Designer Desktop Discussions

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

Generate 2 rows if the day is Friday

Deano478
12 - Quasar

Hi folks,

 

After getting some seriously great help earlier I have one more question to get my project over the line:

 

I have a small unique subset of my data left and essentially all I have left to do is generate two rows for Saturday and Sunday when the day is Friday however I can't seem to get my syntax right.

 

here is a dummy sample of the data below:

 

I just need to generate two rows which will be the Saturday and Sunday for each of these people and boom I'm over the line.

 

IDLeave_DateNameEmailLeave_TypeDay_of_The_WeekDay_of_Week_Number
102/06/2023JamesJames@default.comAnnual LeaveFriday5
209/06/2023JohnJohn@default.comAnnual LeaveFriday5
316/06/2023LeahLeah@default.comAnnual LeaveFriday5
423/06/2023RebeccaRbecca@default.comAnnual LeaveFriday5
530/06/2023TonyTony@default.comAnnual LeaveFriday5

 

 

 

 

7 REPLIES 7
DataNath
17 - Castor
17 - Castor

Hey @Deano478, you can first use the Generate Rows tool to create the 2 new rows:

 

DataNath_0-1683730016121.png

 

Not sure if this step is necessary but you could correct the weekday of the new records with something like this:

 

DataNath_1-1683730040376.png

ShankerV
17 - Castor

Hi @Deano478 

 

One way of doing this.

 

ShankerV_0-1683730293473.png

 

 

Step 1: Input

 

ShankerV_1-1683730332589.png

 

Step 2:

 

ShankerV_2-1683730352770.png

IF [Day_of_The_Week] = "Friday"
THEN 3
ELSE 1
ENDIF

 

ShankerV_3-1683730366730.png

 

Step 3: 

 

ShankerV_4-1683730387626.png

 

ShankerV_5-1683730402474.png

 

Step 4: 

ShankerV_6-1683730425140.png

 

IF [RowCount] = 2
THEN "Saturday"
ELSEIF [RowCount] = 3
THEN "Sunday"
ELSE [Day_of_The_Week]
ENDIF

 

ShankerV_7-1683730440591.png

 

 

Many thanks

Shanker V

FinnCharlton
13 - Pulsar

Hi @Deano478 , you can do it using your Leave Date

FinnCharlton_0-1683730220632.png

 

Deano478
12 - Quasar

Hi Guys, I should have provided more data here is a more accurate sample for the case you can see that tony is off for a while and theres two weekends missing how could I navigate a situation like this to get those dates in? 

 

Employee_NameIDLeave_DateDay Of WeekLeave_TypeEmail
Tony2301/08/2023MondayStudy LeaveTony@default.com
Tony2302/08/2023TuesdayAnnual LeaveTony@default.com
Tony2303/08/2023WednesdayAnnual LeaveTony@default.com
Tony2304/08/2023ThursdayAnnual LeaveTony@default.com
Tony2308/08/2023TuesdayAnnual LeaveTony@default.com
Tony2309/08/2023WednesdayStudy LeaveTony@default.com
Tony2310/08/2023ThursdayStudy LeaveTony@default.com
Tony2311/08/2023FridayStudy LeaveTony@default.com
Tony2314/08/2023MondayStudy LeaveTony@default.com
Tony2315/08/2023TuesdayStudy LeaveTony@default.com
Tony2316/08/2023WednesdayStudy LeaveTony@default.com
Tony2317/08/2023ThursdayStudy LeaveTony@default.com
Tony2318/08/2023FridayStudy LeaveTony@default.com
DataNath
17 - Castor
17 - Castor

@Deano478 how does this look? If the day is a Friday we just look for the Sunday date and generate rows until then, then re-format dates/day of the week as necessary:

 

DataNath_0-1683732737021.png

Deano478
12 - Quasar

@DataNath That's absolutely perfect I genuinely could never have figured that out myself so I'm gonna go through your solution in depth to see exactly what you did so if it comes up again I know what to do 

DataNath
17 - Castor
17 - Castor

Great to hear @Deano478 - if you want the steps explaining then let me know, happy to break it down! Understand if you want to flick through and figure it out yourself though :)

Labels
Top Solution Authors