Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

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
raju_insights
Contributor III

Re: Adding two different values in set analysis

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))


MVP
MVP

Re: Adding two different values in set analysis

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

Re: Adding two different values in set analysis

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
Contributor III

Re: Adding two different values in set analysis

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

MVP
MVP

Re: Adding two different values in set analysis

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.