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

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

P() realated Query

Hi,

i want to show the TOTAL SUM of Turnover Member, City wise for only those Member, City which were there in Q2.

i have created a dummy table which is as below :

MEMBERQUARTERCITYTURNOVER
RAJESHQ2DELHI3000
RAJESHQ2MUMBAI5000
AMITQ2MUMBAI4000
SURESHQ2DELHI3000
RAJESHQ3MUMBAI3000
RAJESHQ3DELHI2000
AMITQ3MUMBAI4000
AMITQ3DELHI1000
SURESHQ3DELHI5000
SURESHQ3MUMBAI3000

OUTPUT what i excpecting

MEMBERCITYTOTAL TURNOVER
RAJESHDELHI5000
RAJESHMUMBAI8000
AMITMUMBAI8000
SURESHDELHI8000

The above output is showing only those Member and City Turnover those were present in both Quarter.

i have tried below mention SET Analysis

sum( {$<CITY=P({$<QUARTER={'Q2'}>} CITY )>} TURNOVER)

but this SET Analysis is working proper only when i selected a Particular Member only.

Please find attacehed Dummy Excel table for same.

5 Replies
Not applicable
Author

Adding the QVW also for ready reference,

sunny_talwar

One way would be to add a concatenate column in the script:

Table:

LOAD *,

  MEMBER & '|' & CITY as KEY;

LOAD * Inline [

MEMBER, QUARTER, CITY, TURNOVER

RAJESH, Q2, DELHI, 3000

RAJESH, Q2, MUMBAI, 5000

AMIT, Q2, MUMBAI, 4000

SURESH, Q2, DELHI, 3000

RAJESH, Q3, MUMBAI, 3000

RAJESH, Q3, DELHI, 2000

AMIT, Q3, MUMBAI, 4000

AMIT, Q3, DELHI, 1000

SURESH, Q3, DELHI, 5000

SURESH, Q3, MUMBAI, 3000

];

and then using this expression:

=Sum({<KEY = p({<QUARTER = {'Q2'}>})>}TURNOVER)

Output:

Capture.PNG

Not applicable
Author

Thanks for you active response and appreciated ur effort

I dont want to make a KEY of Member and City field because my data have many others fields too and huge in size also. for understanding purpose only i share only relevant fields. and in future if i required to same things on different combination also.

Thanks & Regards,

Jitendra K Vishwakarma

jonathandienst
Partner - Champion III
Partner - Champion III

Do you have a unique identifier field in your data set?. I think this will be necessary for the type of set expression require (and that I have in mind)

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
priyarane
Specialist
Specialist

186569.PNG

Hi Jitendra,

Try this approach,

1. add calculated dimension for City  - =if(QUARTER='Q2',CITY)

2. Expression : aggr(sum(TURNOVER),MEMBER,CITY)