Alteryx Designer Desktop Discussions

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

How do I set day of the week to a Saturday

HB_96
5 - Atom

In line with my organisation's start of the week, I want to start it from a Saturday. I've looked at the %w which has 0 as Sunday. Is anyone able to help me understand how I can start day of the week as Saturday? Very new to Alteryx. TIA

 

I have date: day_dt= DateTimeAdd([start_date],[RowCount]-1,'days') which starts 2018-01-01

                   day_name= DateTimeFormat([day_dt],"%A")

 

I then did the w% calculation= tonumber(datetimeformat([day_dt], '%w')) which brings back Sunday as 0. But our week starts on a Saturday.

                 

6 REPLIES 6
Luke_C
17 - Castor

Can you share some data to put this into more context?

HB_96
5 - Atom

Tried to add a couple of bits into the original post - is that helpful?

BS_THE_ANALYST
14 - Magnetar

@HB_96 

check this: https://help.alteryx.com/20223/designer/datetime-functions 

 

BS_THE_ANALYST_0-1679404804586.png

 

If your date isn't the the ISO format YYYY-MM-DD, it won't be recognised in Alteryx as a date datatype, i.e.
convert it using datetime tool as a first step (if you need to do this part):

BS_THE_ANALYST_1-1679404944816.png

 

Then after this, you can use the formula tool to access the weekday name:

BS_THE_ANALYST_2-1679404999800.png

You can then do something like this using the SWITCH function in the formula tool:

BS_THE_ANALYST_3-1679405195637.png

This allows you to map different numbers to the days of the week.

There's probably other ways to do this of course! 😁

 

HB_96
5 - Atom

Thank you! This worked :)

Christina_H
14 - Magnetar

Do you want something like this?

Mod(ToNumber(DateTimeFormat([Date],"%w"))+1,7)

Christina_H_0-1679405766836.png

 

AlexanderVM
Alteryx
Alteryx

@HB_96 

Sharing similar info to what some of the comments here have. The workflow will allow you to set your: Start Week number and also allow you to adjust your Day # of the Week.

Start Your Week on Your favorite Day is created in relation to setting (Week Start Day, Week Start Number, Day of Week Start)

AlexanderVM_0-1679421126158.png

 

Labels