Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

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.

chukleswk
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