Alteryx Designer Desktop Discussions

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

Days in period help calculating

hannahrakow
6 - Meteoroid

I got help on this community calculating the days in month using only the year. I need to do something similar with the days in quarter as well as for number of days that have passed in the year so far. I'm going to attach the formulas I have built so far and what I need to build with examples to hopefully help! Thank you. 

 

Example:

Q1 2021 has 90 days

and as of April 2021 120 days have passed

3 REPLIES 3
apathetichell
18 - Pollux

datetimeformat([date]"%j") will give you the day number a date in the year is.

 

Tell me what you are trying to do in terms of comparing a date to a quarter and I can write out the formula for you - I also wouldn't use fixed decimal for these functions - they return an integer. There's no partial credit with datetimediff.

 

For standard quarters, I find it's easiest to think of them as the month number floor division by 3 +1. You can therefore get this number as floor(datetimeformat([date],"%m"),3)+1

hannahrakow
6 - Meteoroid

So I dont have any actual date field. I have Month+year so April 2021 for example but not in the 4-01-2021 format. 

 

I also don't need the total number of days in the year, I already have that. I need the number of days that have passed in the year so far. For example for april 2021 120 days have passed

for may 2021 151 days have passed

and so on 

 

For quarter I need it to return for example q1 2021 has 90 days, q2 2021 has 91 days. 

apathetichell
18 - Pollux

I know - datetimeformat([date],"%j" gives you the number of days that have passed in a year by date. see attached workflow for examples and conversions to dates.

Labels