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

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Adding two different values in set analysis

Hi all,

I have two set expressions which get two different counts of different campaigns. Now, i need to add the two counts.

Expressions:


1)  IF(match(Metrics, 'List Size'),sum({$<email_type_id = {44}, campaign_name_id = {"$(=max(campaign_name_id)-11)"}>}delivered))

2)  IF(match(Metrics, 'List Size'),sum({$<email_type_id = {44}, campaign_name_id = {"$(=max(campaign_name_id)-9)"}>}delivered))

I need to add the counts of two different Campaign_name_id's.

I used like below but not working

IF(match(Metrics, 'List Size'),sum({$<email_type_id = {44}, campaign_name_id = {"$(=max(campaign_name_id)-11)","$(=max(campaign_name_id)-9)"}>}delivered),

Thanks,

Kuamr

5 Replies
rajuamet
Partner - Creator III
Partner - Creator III

Hi Kumar Pramod,

Did you try like this,

IF(match(Metrics, 'List Size'),sum({$<email_type_id = {44}, campaign_name_id = {"$(=max(campaign_name_id)-11)"}>}delivered))

+

IF(match(Metrics, 'List Size'),sum({$<email_type_id = {44}, campaign_name_id = {"$(=max(campaign_name_id)-9)"}>}delivered))


jagan
Partner - Champion III
Partner - Champion III

Hi,

Try like this

sum({$<Metrics={'List Size'}, email_type_id = {44}, campaign_name_id = {"$(=max(campaign_name_id)-11)", "$(=max(campaign_name_id)-9)"}>}delivered)


Hope this helps you.


Regards,

jagan.

Not applicable
Author

Hi jagan,

Is any other way i can get the campaign_name_id as now i am using

campaign_name_id = {"$(=max(campaign_name_id)-11)"}

without hard coding -11, because if any other new campaign is added then it will fetch the data of other campaign.

I have attached the sample data,

My campaign starts on every tuesday and ends on sunday.

For example today new campaign is started, now i need the last campaign data.

how can i use the date fields in the table to get the last campaign_name_id values?

igdrazil
Creator III
Creator III

did you think about using a variable for that "-11" and use qsVariable for adding the Campaign you want?

you could pre-define your campaigns there or just give a field where to add the number of the campaign you want to see

qsVariable‌ (this is the Qlik Branch Link)

Regards

Chris

jagan
Partner - Champion III
Partner - Champion III

Hi Kumar,

You can try

=max(campaign_name_id, 2) to get previous campaign data always.  -- for attached file you always get 64

Please check.

Regards,

Jagan.