In case you missed the announcement: The Alteryx One Fall Release is here! Learn more about the new features and capabilities here
ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests after December 31, 2025. Set up your security questions now so you can recover your account anytime, just log out and back in to get started. Learn more here
Start Free Trial

Alteryx Designer Desktop Discussions

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

How to select first 5 days' records from each calendar month of given data set?

TMHC
5 - Atom

I am using the following formula, but all results are coming back true.

 

if datetimediff(DateTimeTrim([ApprovedDate],"firstofmonth"),[ApprovedDate],"days")<=5 then
1 else 0 endif

 

Thanks in advance! 

4 REPLIES 4
AkimasaKajitani
17 - Castor
17 - Castor

Hi @TMHC ,

 

I recognized that you would like to judge the [ApprovedDate] within 5 at the beginning of the month.

The start and end dates are reversed at DateTimeDiff expression.

This is the correct expression.

 

if datetimediff([ApprovedDate],DateTimeTrim([ApprovedDate],"firstofmonth"),"days")<=5 then
1 else 0 endif

 

If the complex expression doesn't work well, I recommend that you cut up them into pieces.

chuckleswk
11 - Bolide

You can pull the records using a filter if the [ApprovedDate] is in date format by using a custom filter formula of: 

  • tonumber(right([ApprovedDate],2)) <= 5

Capture.PNG

TMHC
5 - Atom

@akimasakajitani

 

Thank you so much. That worked! 

AkimasaKajitani
17 - Castor
17 - Castor

Hi @TMHC ,

 

I'm glad it works well.

If you have solved the problem, it would be helpful if you could accept it as a solution so that people can refer to it later.

Labels
Top Solution Authors