Alteryx Designer Desktop Discussions

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

Version 11 not running version 10 formula

BarleyCorn
8 - Asteroid

Hi,

 

In my old version of alteryx I had the following DateTime in a formula tool to create a new column with Week Commencing based on a column of dates:

 

Week0Comm = datetimeadd(tostring([Year],0)+'-01-01',1 - tonumber(datetimeformat(tostring([Year]),0)+'-01-01', "%w")),"days")

 

Followed by:

 

WeekComm = datetimeadd([Week0Comm], tonumber(week)*7,"days")

 

And output in old version gave me WeeKComm with the correct week commencing for the date in the data.

 

The error message in the new version is centered on the '-01-01' 

 

Old workflow is attached. Help Please!!

 

3 REPLIES 3
Balders
11 - Bolide

Your error seems to be focused around the DateTimeAdd in Week0Comm. I'm not sure what changed between version 10 and version 11 but I think the first part of the DateTimeAdd needs to explicitly be a date. If you wrap a date time parse around [Year1]+'-01-01' then the formula works. In full this is the formula that I got to work.

 

datetimeadd(DateTimeParse([Year1]+'-01-01',"%Y-%m-%d"),1 - tonumber(datetimeformat(tostring([Year1],0)+'-01-01',"%w")),"days")

 

I hope this helps :)

MarqueeCrew
20 - Arcturus
20 - Arcturus

Tom,

 

Here is a version for you to try.

 

Cheers,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
patrick_digan
17 - Castor
17 - Castor

@BarleyCorn I just ran into the same issue as you where I was creating a date with strings in 10.0 but my formula didn't work in 11.0. It seems as though they've fixed it in 11.3.

Labels