BookmarkSubscribeRSS Feed
LeviSche
Calcite | Level 5

Hi everyone, 
I need to create a kpi with a measure where i can count the number of selection in a global filter. This filter have multiselection and is Date type. Thanks

1 REPLY 1
HunterT_SAS
SAS Employee

You should be able to do this by creating a Distinct Count of your Date data item, then using that new measure in the KPI.

1. Right-click on the Date data item and select New Calculation

2. First option should be Distinct so create that

3. Use that distinct count in the KPI

4. Ensure the list control filters the KPI.

 

Now by doing this if you have 0 selections in the list, then the KPI is going to show a distinct count of all date items (because it's not being filtered by anything). If you need the KPI to show 0 then you can take the following extra steps:

1. Right-click on the List control and select New Parameter

2. Create the new parameter, you shouldn't need to make any changes to it aside from the name if you want

3. Back on the KPI, add a local filter that does something like this:

IF (IsSet('Date Parameter'p))
RETURN 1=1
ELSE 1=0


This is checking to see if the Date Parameter is set (meaning at least one selection has been made). If so, then we return true, else we return false. 
When it's all done it should work like this:

HunterT_SAS_0-1747828855075.png

HunterT_SAS_1-1747828879744.png

 



hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 1 reply
  • 388 views
  • 0 likes
  • 2 in conversation