# QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld 2022, LIVE in Denver CO., May 16-19, 2022. REGISTER NOW TO RECEIVE EARLY BIRD PRICING
cancel
Showing results for
Did you mean:
Creator

## GetSelectedcount and Set Analysis

Hi!

I have the expression:

IF(GetSelectedCount(date)=0,

Sum({<consecutive= { \$(=MAX(consecutive)-1)} >} field1),

(Sum(field1))

)

I have dates, and the rule is:

if there is no one selected, sum field1 by the max date

if there one or more than one date selected, sum field1 by that dates.

The code ots ok with the rule, but, its slos, and i think if I can do it all in set analysis will be faster than now.

Thanks!!

1 Solution

Accepted Solutions
Creator
Author

I have solved it! But i didnt say thats it was in qlik sense....

I create a variable:

=if(GetSelectedCount(date) = 0, '\$(=Max(consecutive))', concat(distinct consecutive,','))

And in the expression I call it:

Sum( {< consecutive= {\$(=myvar)} >} field1)

Its SO MUCH FASTER!

Thanks everybody!!

3 Replies
MVP

It's probably slow because with this kind of expression you are calculating both results every time. See How Not to Choose an Expression | Qlikview Cookbook ‌ for an explanation and solutions.

-Rob

http://qlikviewcookbook.com

Master

It's better you use two expressions and put enable condition like GetSelectedCount(date)=0.

It will be faster.

Creator
Author

I have solved it! But i didnt say thats it was in qlik sense....

I create a variable:

=if(GetSelectedCount(date) = 0, '\$(=Max(consecutive))', concat(distinct consecutive,','))

And in the expression I call it:

Sum( {< consecutive= {\$(=myvar)} >} field1)

Its SO MUCH FASTER!

Thanks everybody!!

Community Browser