Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

berryandcherry6
Contributor II

Getting counts of dynamic values

Hi all,

i am trying to get current_campaign_id by putting  where condition to CurrentCampaignData.and then passing current_campaign_id  to set analysis.

CurrentCampaignData:

Load

batch_meta_data_id,

campaignid as current_campaign_id

Resident CAMPAIGN

WHERE ( current_start_date = Date( weekstart (Num ( today() ) )+1)) and match(batch_meta_data_id ,'23','24');

count({$<DateType= {'completion'},final_test_status={'passed'},campaign_id = P(current_campaign_id)>} course_completed)


This works fine, but  i want to put this same logic in expression instead of loading in script .How could i do this.?

Please help me in this regard.


Thanks

21 Replies

Re: Getting counts of dynamic values

Not sure I understand what you are looking for

berryandcherry6
Contributor II

Re: Getting counts of dynamic values

Hi Sunny,

According to above solution, for every batch_meta_data_id and current_start_date,i need to create tables like CurrentCampaignData.

I mean for 8 batches i will be needing to create 8 tables in script like CurrentCampaignData to get current_campaign_id according to current_start_date  and batch_meta_data_id.

So is there any other way,where i could acheive this  like  can we use this conditions in setanalysis itself ?to get counts.

Regards

berryandcherry6
Contributor II

Re: Getting counts of dynamic values

Hi sunny,

Please check i have edited my question, you may ask question if you need clarification.

Thanks,

Supriya

Re: Getting counts of dynamic values

May be this:

Count({$<DateType= {'completion'}, final_test_status={'passed'}, batch_meta_data_id = {23, 24}, current_start_date = {"$(=Date(WeekStart(Today()) + 1, 'DateFieldFormatHere))"}>} invitation_id)

Replace DateFieldFormatHere with the date format of current_start_date

berryandcherry6
Contributor II

Re: Getting counts of dynamic values

Hi sunny,


Count({$<DateType= {'completion'}, final_test_status={'passed'}, batch_meta_data_id = {23, 24}, current_start_date = {"$(=Date(WeekStart(Today()) + 1, 'MM-DD-YYYY'))"}>} invitation_id)



If i do this,it wont filter for particular "current_campaign_id" , here we are not passing current_campaign_id.

The above expression gives same result as ---


Count({$<DateType= {'completion'}, final_test_status={'passed'}, batch_meta_data_id = {23, 24}>} invitation_id)


Thanks

Re: Getting counts of dynamic values

How about this:

Count({$<DateType= {'completion'}, final_test_status={'passed'},

current_campaign_id = p({<batch_meta_data_id = {23, 24}, current_start_date = {"$(=Date(WeekStart(Today()) + 1, 'DateFieldFormatHere))"}>})

>} invitation_id)

berryandcherry6
Contributor II

Re: Getting counts of dynamic values

Hi,

When i debug below expression used not returning any value

current_campaign_id = p({<batch_meta_data_id = {23, 24}, current_start_date = {"$(=Date(WeekStart(Today()) + 1, 'MM-DD-YYYY'))"}>})

so Whole expression giving same value with this and without this expression. Am i missing anything here.

Re: Getting counts of dynamic values

I would expect it to work, not sure what might I be missing.

berryandcherry6
Contributor II

Re: Getting counts of dynamic values

Hi sunny,

Here i need to get  'current_campaign_id' to get count of invitations.

Please help me on this.

Regards,

Supriya

Community Browser