Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
See why BI users voted Qlik #1 in 11 categories. GET REPORT
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
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
Highlighted
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
Highlighted
Partner
Partner

Hi haifend,

Instead of getselectedcount use simple count .

Thanks,

Arvind Patil

Highlighted
Master II
Master II

Hi Haifeng,

Just modify your expression like this

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

Br,

KC

Best Regards,
KC
Highlighted
Contributor III
Contributor III

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

Highlighted
Contributor III
Contributor III

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

Highlighted
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

Highlighted
Master II
Master II

pfa

Best Regards,
KC
Highlighted
Contributor III
Contributor III

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

Best Regards,

Haifeng

Highlighted
Contributor III
Contributor III

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

Highlighted
Master II
Master II

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

Br,

KC

Best Regards,
KC