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