Alteryx Designer Desktop Discussions

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

Formula tool Date rang

Basma_alrubaish
6 - Meteoroid

Hi community,

 

i would highly appreciate some help with my issue 

 

i am trying to use a formula tool to calculate the period of six months prior to the date in my input file 

 

so the input file date is june 30 2024, and i need the formula tool to calculate it back to jan 1 2024, and so on for dec 

 

is there a way to do that?

6 REPLIES 6
Raj
16 - Nebula

@Basma_alrubaish 
yes this can be done using formula tool.

datetimeformat(DateTimeAdd(DateTimeparse([Date],"%B %d %Y"),-6,"months"),"%B %d %Y")

Basma_alrubaish
6 - Meteoroid

thank you Raj

 

do you know what formula i can use to get the results? 

 

if i use DateTimeAdd([Period start ], -180, 'day') it will give me exactly 180 days diff

 

but i want the start day for june 30 to be jan 1 

and for dec 31 to be june 30 

Raj
16 - Nebula

@Basma_alrubaish Try this.
datetimeformat(DateTimeTrim(DateTimeAdd(DateTimeparse([Date],"%B %d %Y"), -180,'days'), 'month'),"%B %d %Y")


mark done if solved.

Raj
16 - Nebula

@Basma_alrubaish 
find workflow attached for reference

Basma_alrubaish
6 - Meteoroid

is there a way i can use the same initial formula but have the start date fixed as the first date of the month?

 

DateTimeAdd([Period start], -6, 'months')

 

Raj
16 - Nebula

@Basma_alrubaish 
this will work
datetimeformat(DateTimeTrim(DateTimeAdd(DateTimeparse([Date],"%B %d %Y"), -5,'months'), 'month'),"%B %d %Y")

Labels