Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

New Contributor

Help with date SET analysis - previous month


I need some help, and this has probably been asked a million times before, I just cant get it to work. I need to write a SET analysis for the previous months value count, however I want to use a date range and avoid using variables:

Count({$<Lead_Created_date={">=$(=addmonths(monthstart(max(Lead_Created_date)),-1))<=$(=addmonths(monthend(max(Lead_Created_date)),-1))"},OutcomeName={'Not interested'}>}Reference)

This doesnt return a value, however im sure the code is correct, the issue probably is that Lead_Created_date is a datetime field. Not sure if there is a way to solve this, can anyone help plz?

Thanks in advance.



1 Reply

Re: Help with date SET analysis - previous month

Check here:

Dates in Set Analysis

One of the issue I can think is that Lead_Created_date might have a different date field format causing format mis-match which would lead to non-desired results. Try this:

Count({$<Lead_Created_date={">=$(=Date(MonthStart(Max(Lead_Created_date), -1), 'DateFieldFormatHere'))<=$(=Date(MonthEnd(Max(Lead_Created_date),-1), 'DateFieldFormatHere'))"}, OutcomeName={'Not interested'}>} Reference)