The Alteryx Community is a finalist in three 2026 CMX Awards! Help us win Customer Support Community, Most Engaged Community, and User Group Program of the Year - vote now! (it only takes about 2 minutes) before January 9.
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests Early 2026. Make sure to check your account preferences in my.alteryx.com to make sure you have filled out your security questions. Learn more here
Start Free Trial

Alteryx Server Discussions

Find answers, ask questions, and share expertise about Alteryx Server.

What is this formula doing

tojo
6 - Meteoroid

This formula is assigning to week. I need to understand what this is doing.

   PadLeft(ToString(FLOOR(DateTimeDiff(DateTimeAdd([Datum],4- 
Switch(DateTimeFormat([Datum],"%a"),7,"Mon",1,"Tue",2,"Wed",3,"Thu",4,"Fri",5,"Sat",6),"days"),DateTimeParse(ToString(ToNumber(DateTimeFormat(DateTimeAdd([Datum],4-Switch(DateTimeFormat([Datum],"%a"),7,"Mon",1,"Tue",2,"Wed",3,"Thu",4,"Fri",5,"Sat",6),"days"),"%Y")))+'-01-01',"%Y-%m-%d"),"days")/7)+1),2,"0")

 

//Tony

2 REPLIES 2
gabrielvilella
14 - Magnetar

Hi @tojo, this is a Server discussion channel. But I can point you to the answer. The best way for you to understand what the expression is doing is to analyse it from inside out, breaking it into sections. Take one formula, for example DateTimeFormat([Datum],"%a"), place it on a separate formula and see the result. I also recommend to look into the documentation, there are multiple examples there on every expression. 

https://help.alteryx.com/current/designer/functions 

dYoast
11 - Bolide