Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
varunreddy
Creator III
Creator III

Combinations of selections

Hi Guys,

I have a field called driver.

I have 5 values,

BCBS

Accuracy

Completeness

Gaps

Timeliness.

Now my requirement is

Among any combinations from the above mentioned five, I want true value. Is there a way to do this?

For example:

=if(Concat(DISTINCT [Primary Issue Driver]) = 'BCBSBCBS - AccuracyBCBS - CompletenessBCBS - DQ Control GapsBCBS - Timeliness' or

Concat(DISTINCT [Primary Issue Driver]) = 'BCBS' or

Concat(DISTINCT [Primary Issue Driver]) = 'BCBS - Accuracy' or

Concat(DISTINCT [Primary Issue Driver]) = 'BCBS - Completeness' or

Concat(DISTINCT [Primary Issue Driver]) = 'BCBS - DQ Control Gaps' or

Concat(DISTINCT [Primary Issue Driver]) = 'BCBS - Timeliness' , 'True', 'False').

I want the true values for all the combinations.

I.e on 1 selection,

2 selections, 3,4 or 5 selections.

Regards,

Varun

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Try

=If( Count( {< [Primary Issue Driver] *= {BCBS,Accuracy,Completeness,Gaps,Timeliness}>} [Primary Issue Driver]), TRUE(), FALSE() )

If you want to handle cases with no selection at all as FALSE(), use

If(GetSelectedCount( [Primary Issue Driver]) AND Count( {< [Primary Issue Driver] *= {BCBS,Accuracy,Completeness,Gaps,Timeliness}>} [Primary Issue Driver]), TRUE() , FALSE() )

View solution in original post

8 Replies
swuehl
MVP
MVP

Wouldn't just

=If(GetSelectedCount( [Primary Issue Driver]), TRUE() , FALSE() )

fit your requirement?

varunreddy
Creator III
Creator III
Author

Hi Swuel,

Thanks for the response. I actually have 10-15 values for Primary Issue Driver. Out of 15, I want only 5 values mentioned above.

Sorry, I didn't mention this.

Not applicable

its not clear ... can you upload a qvw ? if any one or more combinations cann't you write getselectedcount(field)>0 ?

Not applicable

if you can, add a another flag field to identify those 5 field values as 1 and all others 0 and use this field for getselectedcount(field)>0 and getpossiblecount(flagfield)>0

swuehl
MVP
MVP

Try

=If( Count( {< [Primary Issue Driver] *= {BCBS,Accuracy,Completeness,Gaps,Timeliness}>} [Primary Issue Driver]), TRUE(), FALSE() )

If you want to handle cases with no selection at all as FALSE(), use

If(GetSelectedCount( [Primary Issue Driver]) AND Count( {< [Primary Issue Driver] *= {BCBS,Accuracy,Completeness,Gaps,Timeliness}>} [Primary Issue Driver]), TRUE() , FALSE() )

varunreddy
Creator III
Creator III
Author

Can you explain me how to create a flag?

varunreddy
Creator III
Creator III
Author

Hi Swuel,

Thanks for the response. This is working fine. Can you please explain what *= is doing in the expression?

Regards,

Varun

swuehl
MVP
MVP

The intersection operator * is performing an intersection of the 5 listed values with the possible values in the default set, in other words, if you select another value than listed, the intersection would be empty, the count would return zero. Only if at least one of the 5 values is possible / selected, the count would return >0.