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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to add date filter in expression

Count({<[IsConverted] = {'false'}>}LeadId)

Here I want to put a condition where in my campaign table, there is a field called "CampaignEndDate", and I want to get LeadId count where date is greater than  "CampaignEndDate". Pl help.

6 Replies
PrashantSangle

Hi,

I assume that you have one more datefield to compare with CampaignEndDate

then do like this,

Count({<[IsConverted] = {'false'},datefield={">=$(CampaignEndDate)"}>}LeadId)


Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
alexandros17
Partner - Champion III
Partner - Champion III

Count({<[IsConverted] = {'false'}>} If(date > CampaignEndDate, LeadId, 0))

Let me know

Anonymous
Not applicable
Author

"IsConverted" is field from LEAD table,

"CampaignEndDate" is from Campaign table,

LEAD table is connected to Campaignmember table and Campaignmember table id connected to Campaign table.

alexandros17
Partner - Champion III
Partner - Champion III

If connections are correct even set analysis is.

Hope it helps

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

You can't use set analysis here. The set expression is evaluated once for the table (before the dimensions are built) so QV does not know what value of CampaignEndDate to use.

You have two possible solutions:

     Count({<[IsConverted] = {'false'}>} If (datefield >= CampaignEndDate, LeadId))

But Sum(If()), Count(If()) can be performance killers

OR

modify your load script to bring the CampaignEndDate into the same table as the datefield by the appropriate join. Then set a flag value for dates > CampaignEndDate

     LOAD .....

          If(datefield >= CampaignEndDate, 1, 0) As CampaignEndFlag,

          ....

Now you  can use a set expression

         

     Count({<[IsConverted] = {'false'}, CampaignEndFlag = {1}>} LeadId)

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Anonymous
Not applicable
Author

Thank you, Let me give it a try.

Thanks

Surender