BookmarkSubscribeRSS Feed
jplarios
Quartz | Level 8

It seems an easy task but I can't fugure it out; I want to filter a report from Now() to Now()-7 ; basically the current week's worth of data.

Assuming data in memory with a date and date time available to use.

Can anyone help me on this?

17 REPLIES 17
Explore_SAS
Obsidian | Level 7

you can use filter tab on the right hand side of your report desinger to filter the data you want to see in the report.

jplarios
Quartz | Level 8
but would that be relative to a week or hard coding some dates?
Explore_SAS
Obsidian | Level 7
I guess, it would be hardcoding for some dates.
Explore_SAS
Obsidian | Level 7
or else you can add a slider as filter on your report and assign date category to it.
jplarios
Quartz | Level 8

thanks; I was looking foor som preiodic type function; so when the report is refreshed , it only refreshes for the current week; assuming I only have a date and date time available in memory - i.e not having to go back to ETL.

Explore_SAS
Obsidian | Level 7
There is option of function of relative period when you calculate aggregated column, if you want to aggregate something for a relative period, please check if its useful for you.
Sam_SAS
SAS Employee

@Explore_SAS wrote:
There is option of function of relative period when you calculate aggregated column, if you want to aggregate something for a relative period, please check if its useful for you.

 

RelativePeriod operator does not work at the week level, unfortunately.

Explore_SAS
Obsidian | Level 7
Hey sam do you know, how the option of _Inferred_ for grouping period it says that it takes the grouping based on data in the report but it never worked for me.
Sam_SAS
SAS Employee

@Explore_SAS wrote:
Hey sam do you know, how the option of _Inferred_ for grouping period it says that it takes the grouping based on data in the report but it never worked for me.

 

An issue with _Inferred_ is that it will often use an inferred interval period of "day" for the inner interval but the LASR function does not like to process "day" and so the operator returns missing values in most cases.

 

If your date data item has a format like MMMYYYY, then _Inferred_ should correctly set the inner interval to "Month".

 

Personally I always set the interval parameters to the period I want rather than using _Inferred_.

 

Eventually this should work better than it does right now.

Explore_SAS
Obsidian | Level 7
The problem with us is that, we have to calculate the difference with between relative date like what is change of value from yesterday to today. by default VA doesn't have option to choose interval as day. so we have to rely on _inferred_ assuming that VA with automatically understood looking at the data.
Sam_SAS
SAS Employee

The periodic operators do not handle relative dates correctly when the interval is day. Possibly some day processing was supported in earlier releases but it could return bad results. The operators were changed to always return missing values when the interval is day and there is any offset processing to do. I don't remember whether day processing was enabled in any customer-facing release.

Day interval is still fine for operators like Period that do not calculate a difference between dates.

PeterWijers
Lapis Lazuli | Level 10

Answer to your first question is this code used in the filter.

It wil filter out your data for the last 7 days.

If you need the running week then you need a sligtly different code.

Greetings  Peter

06-02-2016 16-19-25.png

Jun_KP
Calcite | Level 5

Hi Peter,

 

Thanks for the filter. I am interested to know how to filter out the running current week instead of the last 7 days. Do you mind share the text code for filtering out the current week?

 

Thanks!

Jun

Sam_SAS
SAS Employee
Possibly you could leverage the DayOfWeek() operator to filter out the days where DayOfWeek(Date) is less than DayOfWeek(DatePart(Now()))

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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
  • 17 replies
  • 3832 views
  • 3 likes
  • 5 in conversation