Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
cmorri1988
Creator
Creator

Complex Set Analysis - Aggregation and P()

Hi there,

I am based on the following selections:

selections.PNG

 

using this measure:

only({1<ID = 
p({<CT_KEY = (P(CT_KEY)),
bisac_sbj1_code = (p(bisac_sbj1_code)),
bisac_sbj2_code = (p(bisac_sbj2_code)),
bisac_sbj3_code = (p(bisac_sbj3_code)),
[Price] = {">=$(vMinCTPrice)<=$(vMaxCTPrice)"},
[Pub Date Num] = {">=$(vMinCTPubDate)<=$(vMaxCTPubDate)"},
ID = e(ID),Author = , Title =, ISBN = >})>}

//Aggregate each match over each selected ID and CTKEY
Aggr(

only({1<ID = 
p({<CT_KEY = (P(CT_KEY)),
bisac_sbj1_code = (p(bisac_sbj1_code)),
bisac_sbj2_code = (p(bisac_sbj2_code)),
bisac_sbj3_code = (p(bisac_sbj3_code)),
[Price] = {">=$(vMinCTPrice)<=$(vMaxCTPrice)"},
[Pub Date Num] = {">=$(vMinCTPubDate)<=$(vMaxCTPubDate)"},
ID = e(ID),Author = , Title =, ISBN = >})>}
Rank6)


,CT_KEY, ID))

the problem I am having is the results are using possible bisac_sbj2_code values for any selection, and not those related to each ID and CTKEY.

Results.PNG

 

From the results, bisac_sbj2_code is blank, but from the selection ISBN 9780007382767,  bisac_sbj2_code is OCCO19000, and so I would like these results to have this code, being aggregated for each selected CTKEY and ID.

 

Any help most welcome!

 

Thanks!

 

 

 

Labels (3)
11 Replies
sunny_talwar

From what I know from Qlik, I don't think this is solvable with just an expression.... but all the best.
cmorri1988
Creator
Creator
Author

FYI,

 

I managed to get this to work by creating the following within the script,

 

CT_KEY&bisac_sbj2_code as bsc2_test,
CT_KEY&bisac_sbj3_code as bsc3_test,

 

 

and changing the measure to:

 
only({1<ID = 
p({<CT_KEY = (P(CT_KEY)),
[BISAC Subject Code] = (p([BISAC Subject Code])),
bisac_sbj2_code = (p(bisac_sbj2_code)),
bisac_sbj3_code = (p(bisac_sbj3_code)),
ID = e(ID), Title =, ISBN = >})>}

//Aggregate each match over each selected ID and CTKEY
Aggr(

only({1<ID = 
p({<CT_KEY = (P(CT_KEY)),
[BISAC Subject Code] = (p([BISAC Subject Code])),
bsc2_test = (p(bsc2_test)),
bsc3_test = (p(bsc3_test)),
ID = e(ID), Title =, ISBN = >})>} ID)


,CT_KEY, ID))

 

 

Thanks