I have data like below.
Date
2024-01-01
2024-02-01
2024-03-01
I need to calculate quarter days across each date.
2024-01-01 - 91(sum of jan,feb,mar 24 days)
2024-02-01 - 91
2024-03-01 - 91
And for
2024-04-01 - 91 ( sum of apr,may,jun 24 days)
How can this be achieved?
Solved! Go to Solution.
Hi @Alteryxexpert ,
Do you mean like this?
I hope this helps.
Workflow
Output
Date | 3 months later | diff |
2024-01-01 | 2024-04-01 | 91 |
2024-02-01 | 2024-05-01 | 90 |
2024-03-01 | 2024-06-01 | 92 |
Formula
3 months later = DateTimeAdd([Date],3,"month")
diff = DateTimeDiff([3 months later],[Date],"day")
Thanks for the response.
The actual ask is if the date is 2024-01-01(Jan 2024) then it is Q1 2024 then the total days should be returned as sum of days in (jan , feb , mar 24) which is 31+29+31 = 91 for all the three months in that quarter it should return 91.
if the date is 2024-04-01(Apr 2024) then it is Q2 2024 then the total days should be returned as sum of days in (apr,May,Jun 24) which is 30+31+30 = 91 for all the three months in that quarter it should return 91.
In your case for Jan , Feb , mar the days count is changing which is not the case, so taking difference between two dates won't work, any other way to do this?
@Alteryxexpert take a look at the attached workflow, it should achieve what you are looking for
@Krzysiek This won't work when it is a leap year or non leap year. And I don't want to hardcode 91,92 across Q1 Q1 , I want Alteryx to compute the numbers.
@aatalai I'm getting the attached error while using your logic
@Alteryxexpert I gave this problem a shot and here attached is my workflow. I first calculated the start and end dates for each quarter based on the date provided, and then compute the difference between the 2 dates. Do let me know if it meets your requirements.