Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
jtay
Contributor III
Contributor III

Help with GetSelectedCount for graph time periods

I have a line graph that displays counts by month.

I want it to default to a 13 month period but still allow a user to interact with the data.

Here's my Measure:

if(GetSelectedCount(C_Surgery_Date)>0,

count({<ORCaseVolumeFlag={1}>} LOG_ID)

,count({<[_R12]={1},ORCaseVolumeFlag={1}>} LOG_ID))//rolling 13 months

here's my Dimension:  monthname(C_Surgery_Date)

The default view is just right.

Clicking on one of the datapoints within the graph (the 13 month range) filters just right.

My problem happens when using a filter pane for C_Surgery_Date and selecting something outside of the 13 months.

The graph is replaced with the text:  The selections generated no data for this chart.

I turned on show zero values after clearing the selection and now it looks like everything outside that 13 month range is zero.

If I just use count({<ORCaseVolumeFlag={1}>} LOG_ID)   it shows everything.

How can I set this up to meet my objective?

Using Sense 3.0

thanks!

1 Solution

Accepted Solutions
jtay
Contributor III
Contributor III
Author

Found out the answer for this one... getselectedcount does not work on a derived field.

I was trying to see if a month  (C_Surgery_Date) was selected, but that field was created in the app load script.

Moved it to the transform and it worked fine. 

View solution in original post

10 Replies
vinieme12
Champion III
Champion III

So you want to show previous 13 months from the selected date

or

previous 13 from the Max(date) if nothing is selected?

is that correct?

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
jtay
Contributor III
Contributor III
Author

I want the default view of the graph to be 13 months.  If a user selects one of the dates in that range, the graph only shows that date and that's fine.   All other visualizations will filter to that date and that's what we want.

The problem is that when you select a date outside of the 13 months shown on the graph, everything goes to zero.

vinieme12
Champion III
Champion III

how are you filtering for 13 months data in the expression

is this the Flag you created for Prior 13 months? ORCaseVolumeFlag

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
jtay
Contributor III
Contributor III
Author

My prior 13 month flag is:  [_R12]={1}

jtay
Contributor III
Contributor III
Author

OK... more digging on this.  I created a KPI with the following value:  GetSelectedCount(C_Surgery_Date) and no matter what months I select, the KPI doesn't change... it stays ate zero.  I think that's my problem.

Does GetSelectedCount have problems counting months?  I've tried lots of iterations of modifying the date field but nothing is working.  thx

vinieme12
Champion III
Champion III

Can you post a sample app

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
jtay
Contributor III
Contributor III
Author

I have attached a sample.  thanks!

jtay
Contributor III
Contributor III
Author

I have attached a sample.  thanks!

vinieme12
Champion III
Champion III

I will check and get back to you

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.