Alteryx Designer Desktop Discussions

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

How can I filter data through the last Sunday

bryanmac_92
Asteroide

FormuHello,

 

I am trying to create a formula and filter data through the last Sunday. For example, the last Sunday was 8/11/24 so then everything after that is filtered out and everything 8/11/24 and before is kept.

 

Here is an example data that I have.

 

DateID
8/13/20242197
8/12/20242908
8/11/20242704
8/10/20247694
8/9/20246240
8/8/20242401
8/7/20247944
8/6/20241585
8/5/20248351
8/4/20245293
8/3/20245667
8/2/20246502
8/1/20247662
7/31/20246032
7/30/20241580
7/29/20242885
7/28/20243141
7/27/20245198
7/26/20244980
7/25/20242847
7/24/20243656
7/23/20241657
7/22/20244147
7/21/20243879
7/20/20249078
7/19/20247338
7/18/20246126
7/17/20248279
7/16/20248022
7/15/20243702

 

Best,

Bryan

5 RESPUESTAS 5
OTrieger
Asteroide

Hello @bryanmac_92 

With the use of DateTimeFormat([Day],"%a") you will get the day Mon to Sun.  Then add today date DateTimeToday().
Now you can filter any date that prior to today. Then with Summarize tool you could find the Max date grouping on days and there you have last Sunday.

Qiu
21 - Polaris
21 - Polaris

Check this post from me and @Yoshiro_Fujimori 

Hi @Qiu ,

Thanks for mentioning me. I agree that the question is very similar to this post.

https://community.alteryx.com/t5/Alteryx-Designer-Desktop-Discussions/Last-Tuesday-of-the-month/m-p/...

 

Qiu
21 - Polaris
21 - Polaris

Forgot about the Link. 😂

@bryanmac_92 ,

For your convenience, you can use this expression in Filter tool.

 

DateTimeParse([Date], "%m/%d/%Y") <=

DateTimeAdd(
  DateTimeToday(),
  - ToNumber( DateTimeFormat( DateTimeToday(), "%w") ),
  "day"
)

Etiquetas