Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

juleshartley
Valued Contributor

Set analysis intersection

HI All,

I'm trying to set the selections in one field 'SchemeNo' to the values of 'PeerSchemeNo' that are the intersection of 2 simple sets. 

I've tried this, but it seems to only return 0 (there is definitely some overlap)

count(DISTINCT

{1
<[SchemeNo]=P({<PeerGroupName={"$(vPG1)"}>}PeerSchemeNo)>
*
<[SchemeNo]=P({<PeerGroupName={"$(vPG2)"}>}PeerSchemeNo)>
}
SchemeNo
)

 

If I set it all to use 'PeerSchemeNo' instead of SchemeNo, then I get the correct number of intersecting schemes. But it is not that field that I want to make affect. Also, if I just use one of the 'P' sets above then it does give me the expected answer, so they seem to be working in isolation.

Thanks,

Julian

Labels (1)
1 Solution

Accepted Solutions
juleshartley
Valued Contributor

Re: Set analysis intersection

SchemeNo={

$(

=concat(DISTINCT{<[PeerSchemeNo]=P({<PeerGroupName={"$(vPG_First)"}>}PeerSchemeNo)>

*

<[PeerSchemeNo]=P({<PeerGroupName={"$(vPG_Last)"}>}PeerSchemeNo)>}PeerSchemeNo,', ')

)

}

4 Replies

Re: Set analysis intersection

Without a sample, this is more going to be a guess work, but try this

Count(DISTINCT {1<[SchemeNo] = P({<PeerGroupName = {"$(vPG1)"}>} PeerSchemeNo) * P({<PeerGroupName = {"$(vPG2)"}>} PeerSchemeNo)>} SchemeNo)

 

MVP & Luminary
MVP & Luminary

Re: Set analysis intersection

Try it with:

count(DISTINCT

{1
<[PeerGroupName]=P({<PeerGroupName={"$(vPG1)"}>}PeerSchemeNo)>
*
<[PeerGroupName]=P({<PeerGroupName={"$(vPG2)"}>}PeerSchemeNo)>
}
SchemeNo
)

- Marcus

juleshartley
Valued Contributor

Re: Set analysis intersection

Thanks both - I'm not sure why it didn't work but I've ended up using a concat to build a string to feed into the set analysis, which seems to work ok

juleshartley
Valued Contributor

Re: Set analysis intersection

SchemeNo={

$(

=concat(DISTINCT{<[PeerSchemeNo]=P({<PeerGroupName={"$(vPG_First)"}>}PeerSchemeNo)>

*

<[PeerSchemeNo]=P({<PeerGroupName={"$(vPG_Last)"}>}PeerSchemeNo)>}PeerSchemeNo,', ')

)

}