Free Trial

Alteryx Designer Desktop Discussions

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

Week Commencing, containing the 1st July, of the current year

RBF
7 - Meteor

Hi all

 

I'm looking for a formula that will give me the week commencing date, of the week which contained the 1st July (our fiscal year start) of the current fiscal year:

 

Ideally output in yyyy-mm-dd format

 

If I run it today it would give me 2022-06-27

if I ran it in January next year it would gve me 2022-06-27

But if I ran it on 2nd July next year it would give me 2023-06-29

 

 

5 REPLIES 5
IraWatt
17 - Castor
17 - Castor

Hey @RBF,

Here is one way of doing it:

IraWatt_0-1663246238856.png

I tryed to split up my calculations so first I find out which year we need to look at based of the month number. Next I convert that yeas 1st July to its day of the month. Then I subtract the number of days to get to the start of that week. Interestingly I believe the 2023 1st of July starts on the 26th not the 29th.

IraWatt_1-1663246329112.png

The community has some quick and easy videos on formulas and the Formula Tool here https://community.alteryx.com/t5/Interactive-Lessons/tkb-p/interactive-lessons/label-name/Writing%20...

 

If your interested in learning more about the datetime functions there is a great cheat sheet Blog here: https://community.alteryx.com/t5/Engine-Works/DateTime-Functions-Cheat-Sheet/ba-p/844353

 

Any questions or issues please ask

Ira Watt
Technical Consultant
Watt@Bulien.com 

 

grazitti_sapna
17 - Castor

One way of doing this is using different table to maintain fiscal year entries and date range and second method is using formula tool and using IF ELSE statement to check if current date lies between range and assign fiscal year. Please find the workflow and let me know if it was helpful.

Sapna Gupta
RBF
7 - Meteor

Yes, that worked great, thanks for fast reply (also, you are correct, the date should be the 26th )

Christina_H
14 - Magnetar

Here's a slightly simplified formula, without having to list all the days of the week

Christina_H_0-1663249698369.png

 

IraWatt
17 - Castor
17 - Castor

Great to hear @RBF ! I would definitely check  out @Christina_H answer as its a lot cleaner solution then mine 😅 (you can green tick multiple solutions). Have a good week !

Labels
Top Solution Authors