Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

set expression

please help me to construct the below set analysis expression-

IF( only(Status) = 'Yes',sum( {<Status = 'Yes'>} 1),  sum({<Status='No'>} 1))

3 Replies
Anonymous
Not applicable
Author

the Syntax is not correct

IF( only(Status) = 'Yes',sum( {<Status = {'Yes'}>} 1),  sum({<Status={'No'}>} 1))

can you explain more what you want to achieve

sunny_talwar

Not really sure your requirement is, but may be this:

If(Status = 'Yes', Count(TOTAL {<Status = {'Yes'}>} Status), Count(TOTAL {<Status = {'No'}>} Status))

rubenmarin

Hi the syntax nedds the value between {}:

IF( only(Status) = 'Yes',sum({<Status={'Yes'}>} 1),  sum({<Status={'No'}>} 1))

That's for avoid the syntax error, but about the logic:

IF( only(Status)= 'Yes' // This check on the current dimension, if all values are 'Yes' it will return "true", for any other cases (all 'No' or a mix of values) it will returns "false"

So if your chart has a dimension with yes and no values it will go to the else and count the 'No'

If you have an Status dimension in the chart you only need an expression like: Sum(1)