Alteryx Designer Desktop Discussions

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

Find if the day & month of a date string falls between day & month of today +/- 7 days

lisebiss
6 - Meteoroid

Dear all,

 

I've tried to find the answer to my question but I have been unsuccessful. I am trying to build a flow to display in Power BI the list of Employees having their work anniversary, based on their hire date. I am therefore trying to find a formula that would enable me to return "1" in a new field if the day and month of their hire date falls between the day & month of today's date +/- 7 days (and return "0" if not of course). This way, i could extrat all people showing "1" as having their work anniversary in the past or coming week. The problem is that i have the feeling that Alteryx is not equipped to process operations on dates ignoring the year. Not so sure how to approach this. Would someone have a brilliant idea to share? 🙂 Million thanks in advance!

9 REPLIES 9
Jean-Balteryx
16 - Nebula
16 - Nebula

Hi @lisebiss ,

 

Can you share sample data ?

@lisebiss  you could use the DateTimeFormat function to separate out the day and month. You could alternatively use the  DatetimeAdd function.=> DateTime Functions | Alteryx Help

 

Hope this helps.

atcodedog05
22 - Nova
22 - Nova

Hi @lisebiss 

 

Here is how you can do it.

Workflow:

atcodedog05_0-1629188030810.png

 

Hope this helps : )

 

Emil_Kos
17 - Castor
17 - Castor

Removed as my solution wasn't working for this use case 😅

lisebiss
6 - Meteoroid

Hello ! Thanks to both of you ! @Jean-Balteryx  I cannot really share the whole file because their are confidential data in their but basically it looks like this below. I have tried a formula based on what you mention @Prashant Chamarty but it returns errors, look 😞 That being said I have basically no idea what I am doing, I started with Alteryx a week ago 😄

Jean-Balteryx
16 - Nebula
16 - Nebula

I think @atcodedog05 's solution solves your problem !

lisebiss
6 - Meteoroid

Thank you @atcodedog05 !!!!!!!!!!!!!!! (and thanks to everyone else as well :)) 😎

atcodedog05
22 - Nova
22 - Nova

Happy to help : ) @lisebiss 

Cheers and have a nice day!

Jean-Balteryx
16 - Nebula
16 - Nebula

I'm being perfectionist here, but when you have to compare to x and -x, you can use Abs() function to simplify your condition :

 

IF Abs(DateTimeDiff(DateTimeToday(),[Current Year Occurrence],"days"))<=7
THEN 1
ELSE 0
ENDIF

 

Polls
We’re dying to get your help in determining what the new profile picture frame should be this Halloween. Cast your vote and help us haunt the Community with the best spooky character.
Don’t ghost us—pick your favorite now!
Labels