Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Using the intersection set operator in a chart expression

Hello,

I am having trouble getting the intersection set operator to work in an expression for a bar chart. I want to count the people who belong to both set operands but the expression is returning no data. In the raw data there are people who belong to both sets. The user needs to select the term of entry for the chart conditions to be fulfilled.

Advice would be appreciated.

Here is the expression I'm currently using;

count

({$<TermofEntry = {$(= only (TermofEntry))},

LevelCode = {'PGR'},

ExtractType = {1},

YearofProgram = {'1'},

RegStatusCode = {'RE','RS'},

InstanceTerm = {$(= only (TermofEntry))},

CollegeCode = {'AF', 'SF', 'HF'},

ResearchDoctMastInd = {R}, ModeofStudy = {'FT'}

> *

<
TermofEntry = {$(= only (TermofEntry))},

LevelCode = {'PGR'},

ExtractType = {1},

YearofProgram = {'2'},

RegStatusCode = {'RE', 'RS'},

InstanceTerm = {$(= only (TermofEntry)+ 100)},

CollegeCode = {'AF', 'SF', 'HF'},

ResearchDoctMastInd = {'R'}, ModeofStudy = {'FT'}

>}
pidm)

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Yes,

that's what I said, I don't think the intersection operator works correctly between two set modifier. But have you tried using the intersection operator like suggested above, within one field element set expression?

Please see attached.

Stefan

View solution in original post

6 Replies
swuehl
MVP
MVP

I wasn't able to use the intersection operator between set modifiers in the past, too (only union and exclusion seem to work). But you can achieve something similar probably using

=count({<PersonKey =p( {<Year={2011}>})*p({<Year= {2012}>})>}  distinct PersonKey)

count

({$

<pidm = p( {

<TermofEntry = {$(= only (TermofEntry))},

LevelCode = {'PGR'},

ExtractType = {1},

YearofProgram = {'1'},

RegStatusCode = {'RE','RS'},

InstanceTerm = {$(= only (TermofEntry))},

CollegeCode = {'AF', 'SF', 'HF'},

ResearchDoctMastInd = {R}, ModeofStudy = {'FT'}

> } )* p({

<
TermofEntry = {$(= only (TermofEntry))},

LevelCode = {'PGR'},

ExtractType = {1},

YearofProgram = {'2'},

RegStatusCode = {'RE', 'RS'},

InstanceTerm = {$(= only (TermofEntry)+ 100)},

CollegeCode = {'AF', 'SF', 'HF'},

ResearchDoctMastInd = {'R'}, ModeofStudy = {'FT'}

>} )

>}

pidm)

Hope this helps and that I haven't missed a bracket here (I hope the idea is clear?)

Regards,

Stefan

Not applicable
Author

Hi,

Thanks for this - the expression builder reads 'expression ok' but no data is being extracted. I can get the original expression working with a union operator but it's not outputting the correct data. Has anything else worked for you when using intersections?

swuehl
MVP
MVP

Could you maybe upload a small sample file? Upload is available here using the advanced editor (follow link in editor).

Not applicable
Author

Hello,

I've attached a small sample file. I have created similar charts using the intersection operator in one and the union operator in the other for the 'Progressed to year 2' expression but as you can see no data is displayed from the intersection expression.

Thanks,

Danielle

swuehl
MVP
MVP

Yes,

that's what I said, I don't think the intersection operator works correctly between two set modifier. But have you tried using the intersection operator like suggested above, within one field element set expression?

Please see attached.

Stefan

Not applicable
Author

Hi Stefan,

That's great - I've tried this in my actual model now and the intersection works. Thanks so much for your help with this.

Danielle