BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
awmeyertimmy
Fluorite | Level 6

I'm trying to build a filter within a crosstab to automatically filter the date. 

 

I have 14 months of data, Dec 16' - Jan 18', but I only want to show data from 4 months ago (This month that would be Oct. 17').  My data set updates each month by rolling forward one month (e.g. my next data set will have dates raning from 1/1/17 - 2/28/18) and I will need the filter to grab data from Nov. 17' only.

 

I currently have this as the syntax of the filter but it is not working correctly.

DatePart(AppVintage) = DateFromMDY(( Month(DatePart(Now())) - 4 ), 1, Year(DatePart(Now())))

 The format of the date field (AppVintage) is DATETIME22.3

 

Can someone help me with this issue?

 

Thanks!

Adam

1 ACCEPTED SOLUTION

Accepted Solutions
FredrikE
Rhodochrosite | Level 12
Create a numeric meassure from year and month and then use rank to select then highest 4. 🙂 //Fredrik

View solution in original post

5 REPLIES 5
ballardw
Super User

I don't use VA so I'm not sure of all the functions that may be available. If you have the INTNX function that will increment date, time and datetime values.

 

so perhaps

AppVintage = intnx('dtmonth',now(),-4,'B');

 

which if the function intnx is available should return the time of the beginning day of the month 4 previous.

awmeyertimmy
Fluorite | Level 6

INTNX would work great! However, I don't believe it's available in Visual Analytics.  That's why I'm stuck. Thanks though!

ballardw
Super User

If a base SAS function such as INTNX or INTCK would be helpful and isn't available in VA you might consider posting a request to add them in the SASWare Ballot section of the forum: https://communities.sas.com/t5/SASware-Ballot-Ideas/idb-p/sas_ideas

FredrikE
Rhodochrosite | Level 12
Create a numeric meassure from year and month and then use rank to select then highest 4. 🙂 //Fredrik
awmeyertimmy
Fluorite | Level 6
Brilliant! Thanks

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 5 replies
  • 2810 views
  • 1 like
  • 3 in conversation