Alteryx Designer Desktop Discussions

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

Changing Posting Date & Dynamic Date

Tid14
8 - Asteroid

Hi,

In the file attached I want to workout with something in which, the data remains as it is just the Posting Date and Document Date changes every month.

For eg- For May its showing  

5/31/2022

So when I'll run the data for June it changes to "Last date of June" i.e 6/30/2022.

 

 

Thanks in Advance

9 REPLIES 9
DataNath
17 - Castor

@Tid14 I can't download your sample yet as it's still doing a virus scan. However, if you want this to always just be dynamic to the end of the current month (when you run the flow), you can just use the 'lastofmonth' DateTimeTrim(), as so:

 

 

DateTimeTrim(DateTimeNow(),'lastofmonth')

 

 

 

DataNath_0-1656361416250.png

 

If you're precious about the format being mm/dd/yyyy then you'll have to wrap it in the DateTimeFormat() function and change the output data type to a string like so:

 

 

DateTimeFormat(DateTimeTrim(DateTimeNow(),'lastofmonth'),'%m/%d/%Y')

 

 

DataNath_1-1656361571824.png

 

IraWatt
17 - Castor
17 - Castor

Hey @Tid14,

You can use some of the date time functions to achieve this:

IraWatt_0-1656361448568.png

DateTimeTrim(DateTimeNow(),"lastofmonth")

This will always return the end of the month whenever you run it.

Any questions or issues please ask :)
HTH!
Ira

 

Luke_C
17 - Castor

Hi @Tid14 

 

You could also just use the 'DateTimeLastOfMonth()' function to do the same thing as the others suggested.

https://help.alteryx.com/20221/designer/datetime-functions

 

DataNath
17 - Castor

@Luke_C I've been on that page so many times and must've skimmed that - never noticed it as a standalone function! Cheers!

IraWatt
17 - Castor
17 - Castor

Thanks @Luke_C 😅

Tid14
8 - Asteroid

If its coming virus scan, I can paste the data for your reference. I want Dates to be in the column next to Document date and posting date. Do i need to use a Cross Tab first and then formula or is there any other way too?

Thanks!

COMPANYXYZ
DOCUMENT DATE5/31/2022
POSTING DATE5/31/2022
DOCUMENT TYPEPP
DOCUMENT REFERENCE1943
DOCUMENT TEXTReclass PQQ loss
CURRENCYXXXX
EXCHANGE RATE 
LEDGER GROUP 
SPECIAL PERIOD 
  
  
MJE TOTAL0.00
DataNath
17 - Castor

No need, you can just do a check as part of your Formula expression to see if it's one of those rows:

 

if [COMPANY] in ('DOCUMENT DATE','POSTING DATE') THEN DateTimeFormat(DateTimeLastOfMonth(),'%m/%d/%Y') else [XYZ] endif

 

 

DataNath_2-1656362833084.png

 

If you're fussy about the leading 0 then you can add the TrimLeft() function too:

 

if [COMPANY] in ('DOCUMENT DATE','POSTING DATE') THEN Trimleft(DateTimeFormat(DateTimeLastOfMonth(),'%m/%d/%Y'),'0') else [XYZ] endif
Tid14
8 - Asteroid

That was really helpful

Thanks Cheers 👍

Tid14
8 - Asteroid

Thanks Cheers :)

Labels