# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Contributor II

## Return two results from IF

I have an IF statement as a variable in set analysis. I want it to show both Assigned and Completed items if nothing else in this field is selected but I am unable to figure this out.

This is what I tried:

vHideUnassigned = If(GetSelectedCount(AssignedCompleted) = 0, 'Assigned' and 'Completed', GetFieldSelections(AssignedCompleted))

Measure in Chart:

Count({<AssignedCompleted={'\$(=\$(vHideUnassigned))'}>}AssignedCompleted)

Tags (2)
1 Solution

Accepted Solutions
MVP

## Re: Return two results from IF

Or this

If(GetSelectedCount(AssignedCompleted) = 0, Count({<AssignedCompleted = {'Assigned', 'Completed'}>}AssignedCompleted), Count(AssignedCompleted))

8 Replies
New Contributor

## Re: Return two results from IF

Hi Dan,

Can you tell me what does AssignedCompleted field contain?

And I think you got your if statement wrong for vHideUnassigned variable.

It can be like this

vHideUnassigned = If(GetSelectedCount(AssignedCompleted) = 0, 'Assigned'&chr(44)& 'Completed', GetFieldSelections(AssignedCompleted))

This should give you two results for the variable.

HTH

Thanks,

Honored Contributor III

## Re: Return two results from IF

vHideUnassigned = If(GetSelectedCount(AssignedCompleted) = 0, Chr(39)& 'Assigned' & Chr(39)&chr(44)& Chr(39)&'Completed'& Chr(39),GetFieldSelections(AssignedCompleted))

Count({<AssignedCompleted={"\$(=vHideUnassigned)"}>}AssignedCompleted)

Honored Contributor III

Contributor II

## Re: Return two results from IF

This did not work. I'm thinking it still must have something to do with all the quotes .

Contributor II

## Re: Return two results from IF

This field contains the values Assigned, Unassigned, and Completed. I want these two values returned so that my chart will default to having these two items displayed, but will also allow changes in selection from the listbox . It may have something to do with the way the variable is in the set analysis but this isn't displaying anything on my chart. I'm trying to figure out how to get the quotations rights as I think that might be the issue.

MVP

## Re: Return two results from IF

May be this

Count({<AssignedCompleted *= {'Assigned', 'Completed'}>}AssignedCompleted)

MVP

## Re: Return two results from IF

Or this

If(GetSelectedCount(AssignedCompleted) = 0, Count({<AssignedCompleted = {'Assigned', 'Completed'}>}AssignedCompleted), Count(AssignedCompleted))

Contributor II

## Re: Return two results from IF

This was a different way at looking at the expression that I had not considered but it is a good idea and also much less complex to look at. Thank you!