Alteryx Designer Desktop Discussions

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

Help with formula

coryanthony
8 - Asteroid

Please HELP!

 

I need a formula that creates a column just for file name. The objective is to have the last day of the most recent month in data set. So if the Max date is "2023-10-15" the the column should be 2023-10-31. 

Field [Entry Date] has different dates going back to 2013. But in this field, the most recent date is 2023-10-15. Therefore, i want a column to say 2023-10-31. 

 

For [Entry Date] 9/30/2013 - i want it to display 2023-10-31 (which is the MAX date it the field (10-15-2023))

 

Current formula - [Account] + "_" + DateTimeFormat(DateTimeAdd(DateTimeAdd(DateTimeTrim([Entry Date], 'month'), 1, 'month'), -1, 'day'), "%Y-%m-%d")

 

Capture.JPG

 

 

8 REPLIES 8
DavidSkaife
13 - Pulsar

Hi @coryanthony 

 

Try this formula instead

[Account] + "_" + DateTimeFormat(DateTimeTrim(DateTimeParse([Entry Date], "%m/%/%Y"),"lastofmonth"),"%Y-%m-%d")
Qiu
21 - Polaris
21 - Polaris

@coryanthony 
We can use the Summarize tool to get the most recent date after converting the [Entry Date] to a Date data type field.

1130-coryanthony.png

coryanthony
8 - Asteroid

HI @DavidSkaife & @Qiu 

 

Thank you for responding. I place a new sample file with input for better explanation. 

 

Based on the [Entry Date], e.g. below. New field should be "32310_10/31/2023.
To clarify. Max[Entry Date] then get the last day of that month. 

Since 10/15/2023 is the last day, Field would then be [Account] + 10/31/2023.

 

AccountEntry Date
3231010/15/2023
3231010/15/2023
323109/27/2017
3231010/31/2017
Qiu
21 - Polaris
21 - Polaris

@coryanthony 
We just need to change a bit on the DateTime Format from my last reply.
And honestly, I dont like to use the "/" in the fiename or so, since it will cause issue sometimes in Windows OS.

1130-coryanthony-1.png

coryanthony
8 - Asteroid

Hi @Qiu 

 

Got it. It does not have to be that format. But i now understand. I can get desire file name by using the summarize tool then bring it back in. Then apply formula. 

Qiu
21 - Polaris
21 - Polaris

@coryanthony 
Yes, you can get the format for date as you like 😁

coryanthony
8 - Asteroid

@Qiu 

 

Thank you so much. One last question. I am using the field name [FileName] for saving over excel file in the output folder. 

The option works perfectly for cvs files but not excel. any ideas as to why?

 

 

 

Qiu
21 - Polaris
21 - Polaris

@coryanthony 
Try to change the Output Options to "Over Sheet or Range".
I will guess you can only get one sheet in the output, right? because everytime new file will be generated for each Sheet when you selected the "Overwrite File" option.

1130-coryanthony-2.png

Polls
We’re dying to get your help in determining what the new profile picture frame should be this Halloween. Cast your vote and help us haunt the Community with the best spooky character.
Don’t ghost us—pick your favorite now!
Labels