This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
Hi all.
I am trying to use datetimediff on week business day only. However, its getting weekend days as well.
To summarize, my desired output would have to be:
Assuming today's date (14th of june), with [DATA] like 2022-06-13 and 2022-06-10 with this formula:
DateTimeDiff([Datetimetoday],[DATA],'days')
Wrong output: 4
Correct output: 2
The formula should not account for saturday and sunday. Is it possible to remove those days?
Thank you very much.
Solved! Go to Solution.
Hey @Joker_Hazard, how does this look? The workflow:
Let me know if this isn't what you wanted and I can revisit!
Hi @Joker_Hazard,
This formula should do the trick.
Since Alteryx counts Sunday as the first day of the week, we first want to identify if a [Date] falls on a Sunday or not.
- If it falls on a Sunday, our week numbers used in the formula should be reduced by 1.
The main formula is as such:
IF [Corrected Today Week Number] = [Corrected Data Week Number]
THEN DateTimeDiff(DateTimeToday(),[Date],'days')
ELSEIF [Data Day of the Week]=7
THEN [Difference btw Today and Date]-(2*([Corrected Today Week Number]-[Corrected Data Week Number]-1))-1
ELSE [Difference btw Today and Date]-(2*([Corrected Today Week Number]-[Corrected Data Week Number]))
ENDIF