Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Get selected count

Hai,

sum(if(getselectedcount(month)=0 or getselectedcount(day)=0 or getselectedcount(year)=0,qty,mnth_qty)

can anyone explain how does it works..what is the result of this.

Thanks in advance

1 Solution

Accepted Solutions
omkarvamsi
Creator
Creator

Hi,


sum(if(getselectedcount(month)=0 or getselectedcount(day)=0 or getselectedcount(year)=0,qty,mnth_qty)


getselectedcount(field) :Gets the output of number of values which we selected from field.

if you select jan,feb from month field,the output will  be 2.

so when ever you didn't make any selections on any one of month,day,year.

the output will be =0,

The condition becomes true because the selection count of the field =0.So the the "Qty" will be the result.

else "mnth_qty"


Hope i make it clear for you


View solution in original post

10 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

HI,

The flow of expression is this way.

If the Value is not selected in Filters like Month, Day and Year then sum the qty of any value is selected from any of this 3 filters then sum the Month Qty.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
surendraj
Specialist
Specialist

Suppose you have..fields month,day,year

if you select any one/two of above three fields TRUE statement will be exicuted.(qty)

if you select three of above fields FALSE  statement will be exicuted.(mnth_Qty)

Anil_Babu_Samineni

This will working as like below

If no selections Sum(qty) else Sum(mnth_qty)



Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anonymous
Not applicable
Author

getselected count function is count the value ,right.and then it'll check condition.am i right.is there any option instead of this function

surendraj
Specialist
Specialist

Hi Anil,

Here or is included in between the conditions.so if he may select any one of the field that will be true.

In above if one condition is true then true is executed.

Am  i correct?

omkarvamsi
Creator
Creator

Hi,


sum(if(getselectedcount(month)=0 or getselectedcount(day)=0 or getselectedcount(year)=0,qty,mnth_qty)


getselectedcount(field) :Gets the output of number of values which we selected from field.

if you select jan,feb from month field,the output will  be 2.

so when ever you didn't make any selections on any one of month,day,year.

the output will be =0,

The condition becomes true because the selection count of the field =0.So the the "Qty" will be the result.

else "mnth_qty"


Hope i make it clear for you


surendraj
Specialist
Specialist

yes..suppose if u select 2 fields from month field.then getselectedcount(month)=2..

Anil_Babu_Samineni

Assumption is correct

If you select anything from those three statements it will give True condition or else false condition

Reply for Last response, yes you are right. There is no other option. Only we have GetSelectedCount() it will get the count of dimension where out static value gives.

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anonymous
Not applicable
Author

Thanks to all.