BookmarkSubscribeRSS Feed
JeremyAT
Fluorite | Level 6

Hi All,

I'm currently working on a dashboard that was developed by someone else and they have used a datasource filter that I'm struggling to wrap by head around. I'm using SAS VA 8.5.1 on SAS Viya 3.05.

 

IF ( 'Rolling Stocktake Schedule'n = 'Year One' )
RETURN ( ( 'Controlled Item Indicator'n = 'YES' ) OR (
'Rolling Stocktake Timetable'n = 'Year One' ) )
ELSE (
IF ( 'Rolling Stocktake Schedule'n = 'Year Two' )
RETURN ( ( 'Controlled Item Indicator'n = 'YES' ) OR (
'Rolling Stocktake Timetable'n = 'Year Two' ) )
ELSE (
IF ( 'Rolling Stocktake Schedule'n = 'Year Three' )
RETURN ( ( 'Controlled Item Indicator'n = 'YES' ) OR (
'Rolling Stocktake Timetable'n = 'Year Three' ) )
ELSE ( 'Main Asset Number'n Missing ) ) )

I can't understand why the filter references 'Rolling Stocktake Schedule'n in both the IF and RETURN statements for all three values of 'Rolling Stocktake Schedule'n, or why the OR statement is used.

Is the filter stating: If 'Rolling Stocktake Schedule' is equal to "Year One" then return any rows where 'Rolling Stocktake Schedule' is equal to "Year One" or 'Controlled Item Indicator'n = 'YES', excluding all others, then repeating this for "Year Two" and "Year Three".

 

In other words, return all rows where 'Rolling Stocktake Schedule' is equal to "Year One", "Year Two", "Year Three", or 'Controlled Item Indicator'n = 'YES'. Is this right?

Also, does the final ELSE statement return any rows where 'Main Asset Number'n = Missing, or excludes these?

 

Any help would be greatly appreciated 😄

 

2 REPLIES 2
MarkusWeick
Barite | Level 11

Hi @JeremyAT, in your post I see different variables in the IF and in the OR clause:

In the IF it's 'Rolling Stocktake Schedule'n and in the OR it's  'Rolling Stocktake Timetable'n.

Maybe you should look into the difference of the two variables?

Best

Markus

 

Please keep the community friendly.
Like posts you agree with or like. Mark helpful answers as “accepted solutions”. Generally have a look at https://communities.sas.com/t5/Getting-Started/tkb-p/community_articles
JeremyAT
Fluorite | Level 6

Hi Markus, 
I managed to understand how the filter was working by creating a calculated item with the same code and looking at what was being included and excluded. In the end, I managed to work out that the filter could be simplified to the follow.

( 'Rolling Stocktake Year'p = 'Rolling Stocktake Timetable'n ) OR
( 'Controlled Item Indicator'n = 'YES' )

Much simpler and more readily understood 😄

Thanks for your help.

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
  • 2 replies
  • 520 views
  • 1 like
  • 2 in conversation