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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Expression not calculating correctly

Hi guys,

I have a field 'Date' which can have various result codes. I want to count the number of contacts in the last month. My expression is:

sum(if(Date>=$(vMonthBack),if(Result='SMC',1,0),0))

However, this gives me the sum of ALL results, not just SMC, so long as there is one SMC in the last month. i.e. if the last month's result codes are:

SOE, SNC, SMC, SLS, SLM, SNC, the expression returns "5" but if the last month's result codes are

SOE, SNC, SLM, SLM, SNC, SNC the expression returns "0".

What am I missing here?

2 Replies
RedSky001
Partner - Creator III
Partner - Creator III

This is quite difficult to follow without seeing your actual data.  Can you attach a qvw with sample data?

I'm pretty sure this would get you more responses.

Mark

whiteline
Master II
Master II

It seems that you have 5 rows for 'SMC' so count returns 5.

Add a tablebox and look at your data.