BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
dhavalyparikh
Obsidian | Level 7

In visual data builder expression date function while creating data query condition - where tab :

I want place conditions like 

Where start_date between intnx(week,start_date, 0,'B') and  intnx(week,start_date, 0,'E')

 

having said - I want to see a list of only those records where startdate is within the current week's first date of week and last date of week. 

 

1 ACCEPTED SOLUTION

Accepted Solutions
KeithM
SAS Employee

The following is an example of the expression that you will need to use.  Note, in the example expression "date" is a data item.  You will have to have a value for your start_date.  I simply hard coded in may 30.

 

intnx('week','30MAY1980'd,0,'B') <= 'date'n <= intnx('week','30MAY1980'd,0,'E')

 

KeithM_0-1667940347455.png

 

View solution in original post

3 REPLIES 3
KeithM
SAS Employee

The following is an example of the expression that you will need to use.  Note, in the example expression "date" is a data item.  You will have to have a value for your start_date.  I simply hard coded in may 30.

 

intnx('week','30MAY1980'd,0,'B') <= 'date'n <= intnx('week','30MAY1980'd,0,'E')

 

KeithM_0-1667940347455.png

 

dhavalyparikh
Obsidian | Level 7

That's great - I will try to implement it tomorrow and get back to you. Thank you very much.

dhavalyparikh
Obsidian | Level 7
Instead of you hardcoded date as intnx('week','30MAY1980'd,0,'B') <= 'date'n <= intnx('week','30MAY1980'd,0,'E')
Is there way I can use the current date ? with my case statement

Start_Date is : (TableDate Value Field)
In below statement

select
ind_latest =
case when Freq="Weekly" and intnx ('Week',Today(),0'b') <= Start_Date<=intnx ('Week',Today(),0'E')
then 1
else 0
run;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

Tips for filtering data sources in SAS Visual Analytics

See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 1688 views
  • 1 like
  • 2 in conversation