Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Generate Rows for End of Month

bertal34
8 - Asteroid

What is an easy way to generate the next 12 dates in this sequence and add 12 rows?  2020-10-31, 2020-11-30, etc.

 

bertal34_0-1665780698105.png

 

11 REPLIES 11
Felipe_Ribeir0
16 - Nebula

Hi @bertal34 

 

One way of doing this, just configure the start/end date properly

 

Felipe_Ribeir0_1-1665781276836.png

 

 

Felipe_Ribeir0_0-1665781218526.png

 

bertal34
8 - Asteroid

Is there a way to limit to 12 months only, no matter what date is initialized?

Emmanuel_G
13 - Pulsar

@bertal34 

 

Find in attachement the way of doing that.

 

Emmanuel_G_0-1665782868495.png

 

Felipe_Ribeir0
16 - Nebula

Hi @bertal34 

 

There is, please check the new version (attached)

binuacs
20 - Arcturus

@bertal34 One way of doing this

binuacs_1-1665783742715.png

 

bertal34
8 - Asteroid

@Felipe_Ribeir0 perfect, thank you!!

Astro55
8 - Asteroid

@binuacs - Your Solution really helps with a use case I have! I'm trying to generate a row of dates, starting from the last day of the previous month to the next 14 months. 

I used your workflow as a starting point. I was able to tweak my Initialization Expression to start from the first date of the previous month. However, I'm struggling with tweaking your formula for the Condition Expression. The expression in your workflow above ends at '-12-31' because the OP wanted to limit the rows to 12 months.

 

Question: How do I amend the Condition Expression to list the next 14 months, instead of stopping at 12/31? 

 

Example:

If I run the workflow today (ie., 3/2/23) using the following conditions

  • Initialization Expression: DateTimeAdd(DateTimeTrim(DateTimeToday(),'firstofmonth'),-1,'month')
  • Condition Expression: Date <= toDate(toString(DateTimeYear(DateTimeToday()))+'-12-31')

This gives me dates from 2023-02-01 through 2023-12-01. However, this is just 11 months. How do I get it for 14 months, i..e, from 2023-02-01 through 2024-03-01. 

 

Astro55
8 - Asteroid

@binuacs - I think I figured it out!

 

  • Initialization Expression: DateTimeAdd(DateTimeTrim(DateTimeToday(),'firstofmonth'),-1,'month')
  • Condition Expression: Date <= DateTimeAdd(DateTimeTrim(DateTimeToday(),'lastofmonth'),+12,'month')

If I run it today (i.e. 3/2/23), it gives me 14 dates, from 2023/02/01 through 2024/03/01!

 

I'm hoping this is correct. Is there a better way of doing it?

binuacs
20 - Arcturus

@Astro55 Updated the workflow and attached

binuacs_0-1677831313492.png

 

Labels