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: 
zhaohaifeng
Contributor III
Contributor III

Getselectedount() issue with if filter

Hi All,

Now we faced the challenge that, if we set if in the filter , than getselectedcount function not works, always show 0 value. Sample as below,

For example we want to judge the count for field Choosemonth,

if we just put Choosemonth in the filter then the Getselectedcount(Choosemonth) works fine,

if we put if in the filter, for example if(ChooseMonth='2017_Sep',ChooseMonth), then if we selected from filter, getselectedcount(Choosemoth) not works. So we cant use if for getselectedcount() function? Any ideas? Thanks.

Best Regards,

Haifeng

1 Solution

Accepted Solutions
jyothish8807
Master II
Master II

Hi,

You can use this expression in your filter:

=if(ChooseMonth='2017_Sep',Aggr(ChooseMonth,ChooseMonth))


To get the count simply use:

Getselectedcount(Choosemonth)


Br,

KC

Best Regards,
KC

View solution in original post

14 Replies
arvind_patil
Partner - Specialist III
Partner - Specialist III

Hi haifend,

Instead of getselectedcount use simple count .

Thanks,

Arvind Patil

jyothish8807
Master II
Master II

Hi Haifeng,

Just modify your expression like this

=if(ChooseMonth='2017_Sep',Aggr(ChooseMonth,ChooseMonth))

Br,

KC

Best Regards,
KC
zhaohaifeng
Contributor III
Contributor III
Author

Hi KC,

I think the expression you mentioned will display the value what we selected, not the count how many we select. Any other ways? Thanks.

Best Regards,

Haifeng

zhaohaifeng
Contributor III
Contributor III
Author

Hi Arvind,


For your suggestion, if we dont select the choosemonth, the value should be all the possible count, in this case, should be 48, Not 0. Thanks.


Best Regards,

Haifeng

jyothish8807
Master II
Master II

Hi,

You can use this expression in your filter:

=if(ChooseMonth='2017_Sep',Aggr(ChooseMonth,ChooseMonth))


To get the count simply use:

Getselectedcount(Choosemonth)


Br,

KC

Best Regards,
KC
jyothish8807
Master II
Master II

pfa

Best Regards,
KC
zhaohaifeng
Contributor III
Contributor III
Author

Thanks KC! It works. May i know the reason? Thanks in advance.

Best Regards,

Haifeng

zhaohaifeng
Contributor III
Contributor III
Author

Hi KC,

One more question, if we use other field in the if judge, then the filter will pop up another one.

For example, we use I_TIME_Key in the case, if we selected the filter, then both i_time_key and choosemonth pop up in the selection bar . Any ideas on that? Thanks.

Best Regards,

Haifeng

jyothish8807
Master II
Master II

Sorry , i am still not clear what you are trying to achieve.

Br,

KC

Best Regards,
KC